sloth456 Posted May 8, 2009 Share Posted May 8, 2009 so I have a date in the following format Y-m-d I want the date 50 days previous to it, is there a simple way to do this? The date must be returned all in numbers. Quote Link to comment https://forums.phpfreaks.com/topic/157406-solved-manipulating-dates/ Share on other sites More sharing options...
premiso Posted May 8, 2009 Share Posted May 8, 2009 strtotime $day_50 = strtotime($date . " -50 Days"); Unsure if it accepts the Y-m-d format, but if it does that would work. Quote Link to comment https://forums.phpfreaks.com/topic/157406-solved-manipulating-dates/#findComment-829792 Share on other sites More sharing options...
sloth456 Posted May 8, 2009 Author Share Posted May 8, 2009 That didn't quite work, heres my code and the output $date=date("Y-m-d"); echo "todays date ".$date."<br>"; $day_50 = strtotime($date . " -50 Days"); echo $day_50; Output: todays date 2009-05-08 1237420800 Thanks for your help so far, really appreciate the effort. Quote Link to comment https://forums.phpfreaks.com/topic/157406-solved-manipulating-dates/#findComment-829877 Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 echo date('Y-m-d', $day_50); Quote Link to comment https://forums.phpfreaks.com/topic/157406-solved-manipulating-dates/#findComment-829888 Share on other sites More sharing options...
sloth456 Posted May 9, 2009 Author Share Posted May 9, 2009 That worked. Thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/157406-solved-manipulating-dates/#findComment-830235 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.