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; ?> 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"); 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 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; ?> 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')); 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... Link to comment https://forums.phpfreaks.com/topic/208343-subtract-from-time/#findComment-1088830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.