iPixel Posted October 19, 2009 Share Posted October 19, 2009 sDate - Start Date eDate - End Date I need to pull two dates for "Last Week" which goes from Sunday to Saturday. So today... Last week would be 10/11/09 as sDate and 10/17/09 as eDate. This... <?php echo date('m-d-Y', strtotime("last sunday")-7); echo " - "; echo date('m-d-Y', strtotime("last saturday")); ?> Prints out 10-17-2009 - 10-17-2009 for some reason the -7 just doesnt work. How can i get the result i want? Thanks! Link to comment https://forums.phpfreaks.com/topic/178278-solved-last-weeks-sdate-and-edate/ Share on other sites More sharing options...
cags Posted October 19, 2009 Share Posted October 19, 2009 Having it outside the strtotime function call means your taking 7 from the unix timestamp. If you wish to take seven days you'd want something more like strtotime("last sunday -7 days"), not sure thats exactly right, but you should get the idea. Link to comment https://forums.phpfreaks.com/topic/178278-solved-last-weeks-sdate-and-edate/#findComment-940013 Share on other sites More sharing options...
jonsjava Posted October 19, 2009 Share Posted October 19, 2009 <?php echo date('m-d-Y', strtotime("last sunday -7 days")); echo " - "; echo date('m-d-Y', strtotime("last saturday")); ?> was already posting when I noticed someone had given the answer Link to comment https://forums.phpfreaks.com/topic/178278-solved-last-weeks-sdate-and-edate/#findComment-940015 Share on other sites More sharing options...
iPixel Posted October 19, 2009 Author Share Posted October 19, 2009 Yepp, that did it. TY Link to comment https://forums.phpfreaks.com/topic/178278-solved-last-weeks-sdate-and-edate/#findComment-940016 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.