The Little Guy Posted January 16, 2009 Share Posted January 16, 2009 Am I missing something? $d = date("Y-m-d H:i:s",strtotime("now - 30 days")); Why, when I do this does it show 30 days into the future, and not 30 days into the past? Link to comment https://forums.phpfreaks.com/topic/141148-solved-strtotime-messed-up/ Share on other sites More sharing options...
kenrbnsn Posted January 16, 2009 Share Posted January 16, 2009 Works for me: <?php $d = date("Y-m-d H:i:s",strtotime("now - 30 days")); echo $d; ?> yeilds: 2008-12-17 18:45:45 php v5.2.5 Ken Link to comment https://forums.phpfreaks.com/topic/141148-solved-strtotime-messed-up/#findComment-738782 Share on other sites More sharing options...
PFMaBiSmAd Posted January 16, 2009 Share Posted January 16, 2009 Works for me - 2008-12-17 16:45:24 I'll guess that you are not using $d correctly or that there is some other error in your code. Link to comment https://forums.phpfreaks.com/topic/141148-solved-strtotime-messed-up/#findComment-738783 Share on other sites More sharing options...
The Little Guy Posted January 16, 2009 Author Share Posted January 16, 2009 I got it by doing this: $d = date("Y-m-d H:i:s",strtotime("-30 days")); Link to comment https://forums.phpfreaks.com/topic/141148-solved-strtotime-messed-up/#findComment-738787 Share on other sites More sharing options...
DeanWhitehouse Posted January 16, 2009 Share Posted January 16, 2009 Don't forget to click solved Link to comment https://forums.phpfreaks.com/topic/141148-solved-strtotime-messed-up/#findComment-738791 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.