Home  >  Article  >  Backend Development  >  How to use php mktime function

How to use php mktime function

藏色散人
藏色散人Original
2019-02-21 14:30:193478browse

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.

How to use php mktime function

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn