How to use php mktime function

藏色散人
Release: 2023-04-05 11:16:01
Original
3516 people have browsed it

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)
Copy after login

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);
?>
Copy after login

Output: Returns the timestamp of 0:00:00 on April 25, 2012

1335283200
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!