Page 1 of 1

Calculating Dates (strtotime())

Posted: Tue Feb 17, 2004 1:43 pm
by kendall
Hello,

the following is code that i use to check if today's date is greater than 2 months ago from a specified date

Code: Select all

<?php if(mktime(0,0,0,date('m'),1,date('y')) >= strtotime($acc_info['ExpireDate'])-strtotime('-2 months')){ // if expiry date is due in 2 months time ?>

i was looking up inpuit formats for the strtotime however i notice nuthing on using months...

would this yield correct results?
strtotime('-2 months')
i get a timestamp but i am unsure if it is correct or not...just wondering

Posted: Tue Feb 17, 2004 1:57 pm
by Weirdan
According to GNU tar manual [ http://www.gnu.org/software/tar/manual/ ... tar_7.html ] (which date formats strtotime resembles) `months` is allowed relative item.