How to add timestamp in php

王林
Release: 2023-03-04 10:04:01
Original
3371 people have browsed it

How to add timestamp in php: You can use the mktime() function to add it. This function returns the UNIX timestamp of a date, or FALSE if it is an error. The specific usage is as follows: [mktime(0,0,0,date("m"),date("d") 1,date("Y"))].

How to add timestamp in php

The mktime() function returns the UNIX timestamp of a date, or FALSE on error.

(Recommended tutorial: php graphic tutorial)

Syntax:

mktime(hour,minute,second,month,day,year,is_dst);
Copy after login

Parameters:

  • hour is 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.

(Video tutorial recommendation: php video tutorial)

Code implementation:

<?php
 $tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
 echo "Tomorrow is ".date("Y/m/d", $tomorrow);
 ?>
Copy after login

Output result:

Tomorrow is 2009/05/12
Copy after login

The above is the detailed content of How to add timestamp in php. 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!