shadiadiph Posted March 30, 2009 Share Posted March 30, 2009 how do i make strtotime number back into a date Y-m-d? i have tried this but it doesn't work? i am tring to make the date that is 3 days before now to use in an sql statement but can't seem to get it right. 259200 is the right amount of seconds problem is with the mktime $today = date('Y-m-d'); $todayintime = strtotime($today); $wantedlog = ($todayintime - 259200); $newtime = strftime("%Y-%m-%d",mktime(0,0,0,$wantedlog)); print $newtime; Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/ Share on other sites More sharing options...
Yesideez Posted March 30, 2009 Share Posted March 30, 2009 One day is 86400 so 86400*3=259200 $now=time(); $wanted=$now-259200; echo 'Now: '.date('d-M-Y H:i:s',$now).'<br />'; echo 'Now: '.date('d-M-Y H:i:s',$wanted); Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/#findComment-796657 Share on other sites More sharing options...
shadiadiph Posted March 30, 2009 Author Share Posted March 30, 2009 thanks Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/#findComment-796662 Share on other sites More sharing options...
Yesideez Posted March 30, 2009 Share Posted March 30, 2009 For future reference time() is measured in seconds. 60=1 minute 3600=1 hour 608800=1 week Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/#findComment-796663 Share on other sites More sharing options...
shadiadiph Posted March 30, 2009 Author Share Posted March 30, 2009 i know that but apparently the time() begain in the 1970's correct Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/#findComment-796665 Share on other sites More sharing options...
Yesideez Posted March 30, 2009 Share Posted March 30, 2009 Yes, that's true. Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/#findComment-796668 Share on other sites More sharing options...
Yesideez Posted March 30, 2009 Share Posted March 30, 2009 http://phplens.com/phpeverywhere/adodb_date_library Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/#findComment-796674 Share on other sites More sharing options...
shadiadiph Posted March 30, 2009 Author Share Posted March 30, 2009 so it is true some people are older than time Link to comment https://forums.phpfreaks.com/topic/151707-solved-making-a-date-from-strtotime/#findComment-796678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.