php - How to find the first day of the week a given date belongs to? -


possible duplicate:
get first day of week in php?

given timestamp need find first day week timestamp belongs to.

e.g.

$format = "first day of week";  //convert time $time = strtotime("2011-07-01 00:00:00");  //format time first day of week $date = strtotime($format,$time);  //put first day of week pretty format $weekstartdate = date("y-m-d",$date); 

the week start should equal 2011-06-27 @ moment gone horribly wrong , equals 1970-01-01 suggests me “first day of week” format invalid.

any ideas appreciated thanks,

$time = strtotime("2011-07-01 00:00:00");  $weekstartdate = date('y-m-d',strtotime("last monday", $time)); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -