How to convert timestamp in php date

藏色散人
Release: 2023-03-06 19:32:01
Original
2595 people have browsed it

How to convert date to timestamp in php: First create a PHP sample file; then use the "echo strtotime("now"), "\n";" method to convert date to timestamp.

How to convert timestamp in php date

Recommended: "PHP Video Tutorial"

Use the strotime function, the code is as follows;

<?php
echo strtotime("now"), "\n";
echo strtotime("10 September 2000"), "\n";
echo strtotime("+1 day"), "\n";
echo strtotime("+1 week"), "\n";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";
echo strtotime("20170808 23:00:01"), "\n";
?>
Copy after login

How to convert timestamp in php date

Extended information:

PHP strtotime() function

1.strtotime, a function that can convert American English format time strings.

2.strtotime() can create a timestamp of a certain moment in English natural language

3. Function syntax: int strtotime(string $time[,int $now])

4. Function: Convert date and time strings in US English format into unix timestamps.

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