The mktime() function is a built-in function in PHP that returns the Unix timestamp of a date. The syntax is mktime(hour, minute, second, month, day, year, is_dst). This function returns an integer Unix timestamp on success and False on error.
php How to use the mktime() function?
php mktime() function returns the UNIX timestamp of a date
Syntax:
mktime(hour,minute,second,month,day,year,is_dst)
Parameters:
hour: Optional. Specified hours.
minute: Optional. prescribed points.
second: optional. Specifies seconds.
month: Optional. Specified month.
day: Optional. Specify days.
year: Optional. Specified year.
is_dst: optional. Set to 1 if the time is during daylight saving time, 0 otherwise, or -1 (default) if unknown. If unknown, PHP will try to find it itself (possibly producing unexpected results).
Return value: This function returns an integer Unix timestamp on success and False on error.
php mktime() function example
<?php echo mktime(0, 0, 0, 4, 25, 2012); ?>
Output: Returns the timestamp of 0:00:00 on April 25, 2012
1335283200
This article is an introduction to how to use the mktime function. I hope it will be helpful to friends in need!
The above is the detailed content of How to use php mktime function. For more information, please follow other related articles on the PHP Chinese website!