PHP time data converted to timestamp code

Source: Internet
Author: User
Tags php tutorial

To do time data conversion to timestamp we use the PHP tutorial with functions, the strtotime () function resolves the date-time description of any English text to a Unix timestamp

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

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

Format Two 2011-02-01

Strtotime ("2011-02-01");

Other reference

<?php
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

All right, there are so many examples of strtotime functions, and friends who need them can refer to them.

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.