Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the timestamp of exactly one week ago in PHP?

I need to calculate the timestamp of exactly 7 days ago using PHP, so if it's currently March 25th at 7:30pm, it would return the timestamp for March 18th at 7:30pm.

Should I just subtract 604800 seconds from the current timestamp, or is there a better method?

like image 580
Mike Crittenden Avatar asked Mar 24 '10 12:03

Mike Crittenden


1 Answers

strtotime("-1 week") 
like image 107
SilentGhost Avatar answered Oct 12 '22 10:10

SilentGhost