Intstrtotime (stringtime [, intnow]) This function is expected to accept a string containing an English date format and try to parse it into a UNIX timestamp. 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.
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 ";
?> $ 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.
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