Php strtotime function UNIX Timestamp

Source: Internet
Author: User

If the time format is absolute time, the now parameter does not work. If the time format is relative time, the relative time is provided by now, or if the now parameter is not provided, the current time is used. -1 is returned if the request fails.

<? 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 ";
?> <? Php
$ Str = 'Not Good ';
If ($ timestamp = strtotime ($ str) ===-1 ){
Echo "The string ($ str) is bogus ";
} Else {
Echo "$ str =". date ('L dS of f y h: I: s A', $ timestamp );
}
?>
This effect is the same as mktime.

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.