Format local time/date as integer. Test all different formats:
<?phpecho idate("B") . "<br>";echo idate("d") . "<br>";echo idate("h") . "<br>";echo idate("H" ) . "<br>";echo idate("i") . "<br>";echo idate("I") . "<br>";echo idate("L") . "<br>";echo idate("m") . "<br>";echo idate("s") . "<br>";echo idate("t") . "<br>";echo idate ("U") . "<br>";echo idate("w") . "<br>";echo idate("W") . "<br>";echo idate("y") . "<br>";echo idate("Y") . "<br>";echo idate("z") . "<br>";echo idate("Z") . "<br>";? >The idate() function formats the local time/date as an integer.
Note: The idate() function only accepts one character as the format parameter!
idate( format,timestamp);
parameter | describe |
---|---|
format | Required. Specify how to return results: B - Swatch Beat/Internet Time d - day of the month h - hour (12-hour clock) H - hour (24-hour format) i - points I - Returns 1 if daylight saving time is enabled, 0 otherwise L - Returns 1 if it is a leap year, 0 otherwise m - the number of the month s - seconds t - Total number of days in this month U - Number of seconds since the Unix epoch (January 1 1970 00:00:00 GMT), same as time() w - day of the week (Sunday is 0) W - Week number of the year in ISO-8601 format, each week starts on Monday y - year (1 or 2 digits) Y - Year (4 digits) z - day of the year Z - Time zone offset in seconds |
timestamp | Optional. Unix timestamp specifying the date/time to be formatted. Defaults to the current time (time()). |
Return value: | Returns an integer formatted according to the specified format using the given timestamp . |
---|---|
PHP version: | 5+ |
Update log: | PHP 5.1.0: Added E_STRICT and E_NOTICE time zone errors. |