Page 1 of 1

Y-m-d question

Posted: Sat Oct 03, 2009 3:00 am
by Addos

Code: Select all

// TEST
$date_due = '2009-10-03';
echo 'date due 2 weeks ago' . date($date_due, strtotime('-2 weeks'));// Want this to show 2009-09-19   
Is there anyway I can substitute Y-m-d with a variable like above? I want to return a few values based on the current date minus 2 weeks but this doesn’t work and I’m not sure how to approach this other than a timestamp and work it out in seconds.

Any help would be great

Re: Y-m-d question

Posted: Sat Oct 03, 2009 3:28 am
by requinix
Take a second (or first) look at how you're supposed to use date.