jj20051 Posted July 20, 2010 Share Posted July 20, 2010 I have a strtotime() function which is supposed to subtract but its giving me weird output... Any suggestions? <?php $currentDate = date("m.d.y");// current date $date = strtotime($currentDate) - strtotime('3 days'); $ttldate = date('m.d.y', $date); echo $ttldate; ?> Quote Link to comment https://forums.phpfreaks.com/topic/208343-subtract-from-time/ Share on other sites More sharing options...
waynew Posted July 20, 2010 Share Posted July 20, 2010 date("d-m-y"); Quote Link to comment https://forums.phpfreaks.com/topic/208343-subtract-from-time/#findComment-1088820 Share on other sites More sharing options...
jj20051 Posted July 20, 2010 Author Share Posted July 20, 2010 Yeah, that failed unfortunately - another random date Quote Link to comment https://forums.phpfreaks.com/topic/208343-subtract-from-time/#findComment-1088822 Share on other sites More sharing options...
waynew Posted July 20, 2010 Share Posted July 20, 2010 <?php $currentDate = time();// current date $date = $currentDate - (86400 * 3); $ttldate = date('m-d-y', $date); echo $ttldate; ?> Quote Link to comment https://forums.phpfreaks.com/topic/208343-subtract-from-time/#findComment-1088826 Share on other sites More sharing options...
PFMaBiSmAd Posted July 20, 2010 Share Posted July 20, 2010 If you had read your previous thread on this, you would have learned the correct way to add/subtract time from the current datetime - $ttldate = date('m.d.y', strtotime('- 3 day')); Quote Link to comment https://forums.phpfreaks.com/topic/208343-subtract-from-time/#findComment-1088828 Share on other sites More sharing options...
jj20051 Posted July 20, 2010 Author Share Posted July 20, 2010 Ok, thank you, I read my last thread to the point where I got an answer, said thank you and moved on with my project. Sorry... Quote Link to comment https://forums.phpfreaks.com/topic/208343-subtract-from-time/#findComment-1088830 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.