Syntax
string gmdate ( string $format [, int $timestamp] ); |
Definition and Usage
This is identical to the date() function except that the time returned is Greenwich Mean Time (GMT).
Paramters
Parameter | Description |
---|---|
format | Required. The format of the outputted date string. See the formatting options for the date() function. |
timestamp | Optional. This is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time(). |
Return Value
Returns a formatted date string. If a non-numeric value is used for timestamp, FALSE is returned and an E_WARNING level error is emitted.
Example
Following is the usage of this function:
<?php echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 2007)); echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 2007)); ?> |
This will produce following result:
Jan 01 2007 00:00:00 Jan 01 2007 07:00:00 |
No comments:
Post a Comment