PHP idate() function
Example
Format the local date/time as an integer. Test all different formats:
<?php echo 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>"; ?>
Definition and Usage
The idate() function formats the local time/date as an integer.
Note:The idate() function only accepts a single character as format Parameters!
Syntax
idate(format,timestamp);
Parameters | Description |
---|---|
format |
Required. Specifies how to return the result:
|
timestamp | Optional. Specifies the Unix timestamp representing the date/time to be formatted. Defaults to the current local time (time()). |
Technical Details
Return value: | Returns based on the specified format Use the given timestamp Formatted integer. |
---|---|
PHP Version: | 5+ |
Update Log: | PHP 5.1.0: Added E_STRICT and E_NOTICE timezone errors. |