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

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
glen09
Forum Newbie
Posts: 6
Joined: Mon Feb 02, 2009 2:37 pm

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

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

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

Post by Benjamin »

Code: Select all

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