getting timestamp for first day of current week

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello

how do i get the TIMESTAMP for the FIRST DAY of the CURRENT WEEK (ie.
monday 00:00:00)?

i tried using strtotime("monday"), but:

- when i use it on a monday, i get monday THIS WEEK
- when i use it on tuesday thru sunday, i get monday NEXT WEEK

i tried "last monday", "monday this week", "this monday", etc. but
nothing helps.

this code proves the issue (2 july is a monday, 8 july is a sunday)

 for($d=2; $d<=8; $d++) {
   $time = strtotime("$d july 2007");
   $date = date("Y-m-d", strtotime("monday", $time));
   echo "$date<br/>\n";
 }

is this a bug, or a locale issue? at any rate, how do i get monday 00:00:00?

thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux