The idate() function formats a local time and/or date as integer.
PHP idate() Function has the following syntax.
idate(format,timestamp);
Parameter | Is Required | Description |
---|---|---|
format | Required. | Format for the result |
timestamp | Optional. | A Unix timestamp that represents the date and/or time to be formatted. Default is the current local time (time()) |
Format letter
PHP idate() Function returns an integer formatted according the specified format using the given timestamp.
The idate() function accepts just one character in the format parameter!
Format a local time/date as integer. Test all the different formats:
<?php/* w w w . ja va 2 s . c o m*/
echo idate("B") . "\n";
echo idate("d") . "\n";
echo idate("h") . "\n";
echo idate("H") . "\n";
echo idate("i") . "\n";
echo idate("I") . "\n";
echo idate("L") . "\n";
echo idate("m") . "\n";
echo idate("s") . "\n";
echo idate("t") . "\n";
echo idate("U") . "\n";
echo idate("w") . "\n";
echo idate("W") . "\n";
echo idate("y") . "\n";
echo idate("Y") . "\n";
echo idate("z") . "\n";
echo idate("Z") . "\n";
?>
The code above generates the following result.