Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the timestamp from last saturday (every week)?

Tags:

date

php

first let me show you my code:

$lastWeek = date('m-d-Y', strtotime('-1 week'));

That's how to get the timestamp from last week. Is there a chance I gan get the timestamp from last saturday?

I hope you know what I mean.

Thanks a lot.

like image 486
oopbase Avatar asked Dec 21 '22 18:12

oopbase


1 Answers

What's wrong with

$last_sat = strtotime("last Saturday"); 

EDIT

The time should be set to '00:00:00';

echo date('d-M-Y H:i:s',$last_sat);

gives

29-Jan-2011 00:00:00
like image 191
Mark Baker Avatar answered Jan 11 '23 10:01

Mark Baker