PHP checkdate() function

P
PHP unixtojd() Function
PHP date_add() function

In this article, you will learn how to check if a date is valid or not. The PHP checkdate() function check if a Gregorian date is valid or invalid.

What is the syntax of the checkdate() function in PHP?

checkdate(month, day, year)
ParametersDetails
monthSpecify the month number(1-12) – Required
daySpecify the month number(1-31) – Required
yearSpecify the year number (1-32767)- Required
PHP checkdate() method

Examples of the checkdate() function

Example 1. In this example, use checkdate() function on different Gregorian dates.

<?php
var_dump(checkdate(01,21,-300));
echo "<br>";
var_dump(checkdate(12,19,2013));
echo "<br>";
var_dump(checkdate(07,09,2021));
?>
PHP unixtojd() Function
PHP date_add() function

Add comment

Tutor Network

Share this

Learn PHP from A to Z