Unix timestamp function strtotime in PHP

Source: Internet
Author: User
    1. Echo Strtotime ("Now"), "\ n";
    2. Echo Strtotime ("Ten September"), "\ n";
    3. Echo strtotime ("+1 Day"), "\ n";
    4. Echo strtotime ("+1 Week"), "\ n";
    5. Echo strtotime ("+1 Week 2 days 4 hours 2 Seconds"), "\ n";
    6. Echo Strtotime ("next Thursday"), "\ n";
    7. Echo Strtotime ("Last Monday"), "\ n";
    8. ?>
Copy Code

Example 2,

    1. $str = ' not good ';
    2. if ($timestamp = Strtotime ($str)) = = = 1) {
    3. echo "The string ($STR) is bogus";
    4. } else {
    5. echo "$str = =". Date (' L DS of F Y h:i:s A ', $timestamp);
    6. }
    7. ?>
Copy Code

This effect is the same as with Mktime ().

Hope that the above introduction and examples, for everyone to help. For the use of PHP strtotime function, you can also refer to: PHP strtotime function Details PHP strtotime function Usage example PHP strtotime () and mktime () y2k38 Vulnerability 2038 issue php timestamp function Strtotime Application Example the function efficiency of strtotime in PHP

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