Php time data converted to timestamp code-PHP source code

Source: Internet
Author: User
To convert time data to timestamp, we use the built-in function of php, strtotime () the function parses the date and time description of any English text into a Unix timestamp to convert the time data into a timestamp. We use the built-in function of php, strtotime () the function parses the datetime description of any English text into a Unix timestamp.

Script ec (2); script

To convert time data to timestamps, we use the built-in function of the php tutorial. The strtotime () function resolves the date and time descriptions of any English text to Unix timestamps.

Format 1: Fri Aug 05 12:19:04 + 0800 2011

Strtotime ("Fri Aug 05 12:19:04 + 0800 2011 ");

Format 2:

Strtotime ("2011-02-01 ");

Other references

Echo (strtotime ("now "));
Echo (strtotime ("3 October 2005 "));
Echo (strtotime ("+ 5 hours "));
Echo (strtotime ("+ 1 week "));
Echo (strtotime ("+ 1 week 3 days 7 hours 5 seconds "));
Echo (strtotime ("next Monday "));
Echo (strtotime ("last Sunday "));
?> Output:

1138614504
1128290400
1138632504
1139219304
1139503709
1139180400
1138489200

Well, there are so many instances of the strtotime function. For more information, see.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.