Home>Article>Backend Development> How to get timestamp in php
How to obtain the timestamp in php: You can use the time() function or strtotime() function to obtain it. The time() function returns an integer containing the Unix timestamp of the current time. The strtotime() function parses any string datetime description into a Unix timestamp.
The time() function returns the number of seconds since the Unix epoch (January 1 1970 00:00:00 GMT) of the current time. Returns an integer containing the Unix timestamp of the current time.
(Recommended tutorial:php graphic tutorial)
Code implementation:
"); echo(date("Y-m-d",$t)); ?>
strtotime() function parses the date and time description of any string Is the Unix timestamp (number of seconds since January 1 1970 00:00:00 GMT).
Grammar:
int strtotime ( string $time [, int $now = time() ] )
(Video tutorial recommendation:php video tutorial)
Parameters:
The above is the detailed content of How to get timestamp in php. For more information, please follow other related articles on the PHP Chinese website!