Get the code for the day before yesterday and the day before yesterday in PHP.
Source: Internet
Author: User
In PHP, the code for getting the day before yesterday and the day before yesterday is the same when I went to the interview the day before yesterday, but I couldn't remember it. remember the date_sub (now (), 'interval 1 DAY') in MYSQL; date ('Y/m/d h: I: S ', mktime (date ('h'), date ('I'), date ('s'), date ('M'), date ('D') + 1, date ('Y ')));
CODE: [Copy to clipboard] Date_default_timezone_set ('Asia/Shanghai ');
# Yesterday
Echo date ("Y/m/d h: I: s", time ()-24*60*60 );
Echo"
";
# The day before yesterday
Echo date ("Y/m/d h: I: s", time ()-2*24*60*60 );
?>
In the past, computing time was always annoying. after learning it, the following is the current time of the next week.
Date_default_timezone_set ('Asia/Shanghai ');
$ Tmp = time () + 60*60*24*7;
Print date ("m/d/y h: I: s", $ tmp );
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.