PHP mktime() function
Example
Returns a UNIX timestamp for a date. Then use it to find the day of the date:
<?php // Output: October 3, 1975 was on a Friday echo "Oct 3, 1975 was on a ".date("l", mktime(0,0,0,10,3,1975)); ?>
Definition and Usage
The gmmktime() function returns the UNIX timestamp of the date.
Tip:This function is similar to gmmktime() The same, but the parameters passed represent the date (not the GMT date).
Syntax
mktime(hour,minute,second,month,day,year,is_dst);
Parameter | Description |
---|---|
hour | Optional. Specify the hour. |
minute | Optional. Specify the minute. |
second | Optional. Specify the second. |
month | Optional. Specify the month. |
day | Optional. Specify the day. |
year | Optional. Specify the year. |
is_dst |
Optional. If the time is during Daylight Saving Time (DST), set to 1, otherwise set to 0, if unknown set to -1 (default). If unknown, PHP will look for itself (which may produce unexpected results). Note:This parameter was deprecated in PHP 5.1.0. Instead, use the new timezone handling features. |
Technical Details
Return Value: | Returns an integer Unix timestamp, or FALSE if an error occurs. |
---|---|
PHP Version: | 4+ |
Update Log: |
PHP 5.3.0: If using is_dst Parameter, then throw an E_DEPRECATED. PHP 5.1.0: The is_dst parameter is deprecated. If mktime() is called without parameters, it will throw an E_STRICT notice. Please use the time() function instead. |