Jump to content

[SOLVED] Last Weeks sDate and eDate.


iPixel

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.