Perhaps there among you who only know the common function to display the time format, such as year, month, and date (Ymd) and also time (hours), such as (H: i: s). Have the date function types such as Checkdate, Date, getdate, and so forth. Okay let's discuss one by one.
1. Checkdate function ()
This function is used to check the validity of a date, or the date of validation of rest. The following general form that I will give.
1. Checkdate function ()
This function is used to check the validity of a date, or the date of validation of rest. The following general form that I will give.
Checkdate (month, day, year)
Months have parameter numbers 1 to 12, representing naming the month of January to December.
Today has parameter numbers 1 to 30/31 and 28/29 if it is February, which have a matter of days in a month Mittenwald.
Years have a valid parameter number from 1 to 3000 more.
<?
var_dump (checkdate (12,31,2000));
var_dump (checkdate (2,29,2003));
var_dump (checkdate (2,29,2003));
?>
So the result is as below.
Months have parameter numbers 1 to 12, representing naming the month of January to December.
Today has parameter numbers 1 to 30/31 and 28/29 if it is February, which have a matter of days in a month Mittenwald.
Years have a valid parameter number from 1 to 3000 more.
<?
var_dump (checkdate (12,31,2000));
var_dump (checkdate (2,29,2003));
var_dump (checkdate (2,29,2003));
?>
So the result is as below.
Looks checkdate function can perform perfectly validity date. False results out, is not valid because we check on February 29, 2003 {checkdate (2,29,2003)}, that date does not exist (you may check in calendar ea).
Try to look at the example below, you can probably understand.
<?
$ try = checkdate (2,29,2003);
echo "February 29, 2003? Reviews";
if ($ try == true) {
echo "Date <b> Fit </ b>";
}
else {
echo "Date <b> No Match </ b>";
}
?>
<br />
<?
echo "January 31, 2011? Reviews";
$ try = checkdate (1,31,2011);
if ($ try == true) {
echo "Date <b> Fit </ b>";
}
else {
echo "Date <b> not match </ b>";
}
?>
So the result is below the following.
Try to look at the example below, you can probably understand.
<?
$ try = checkdate (2,29,2003);
echo "February 29, 2003? Reviews";
if ($ try == true) {
echo "Date <b> Fit </ b>";
}
else {
echo "Date <b> No Match </ b>";
}
?>
<br />
<?
echo "January 31, 2011? Reviews";
$ try = checkdate (1,31,2011);
if ($ try == true) {
echo "Date <b> Fit </ b>";
}
else {
echo "Date <b> not match </ b>";
}
?>
So the result is below the following.
2. Function Date ()
This function is used to display the current date in accordance da time date format used. The following general form that I will give:
Date ('Function Date')
For example:
Date ('Y-m-d')
See good examples of this script:
<?
$ date = date ('l, d F Y');
$ hour = date ('H: i: s: A');
echo "Day / Date:";
echo "<b> $ date </ b> Reviews";
echo "Hours";
echo "<b> $ hour </ b>";
?>
And the results under the following:
This function is used to display the current date in accordance da time date format used. The following general form that I will give:
Date ('Function Date')
For example:
Date ('Y-m-d')
See good examples of this script:
<?
$ date = date ('l, d F Y');
$ hour = date ('H: i: s: A');
echo "Day / Date:";
echo "<b> $ date </ b> Reviews";
echo "Hours";
echo "<b> $ hour </ b>";
?>
And the results under the following:
Up here so hopefully I gave a tutorial can be useful.
Post a Comment