Page 1 of 1

Date calculation: what is the date 50 days ago from today?

Posted: Thu Jun 11, 2009 11:25 pm
by glen09
What is the most efficient way to calculate the date (year, month, date) 50 days ago from today?

I can get the current date and convert it to second, and subtract 50*86400, then convert the seconds back
to date.

Any quicker and easier ways? existing functions to use?

Re: Date calculation: what is the date 50 days ago from today?

Posted: Thu Jun 11, 2009 11:56 pm
by Benjamin

Code: Select all

list($month, $day, $year) = explode('/', date('m/d/Y', strtotime("-50 Days")));
echo "$month/$day/$year";