[PHP-DB] finding out the date of the first day of the current week
I am trying to make a small function that will me the date in Y-m-d of the start of the current week (the sunday) I have only the idea of doing it by making a long drawn out script with if, elseif clauses for every day of the week... and then doing something like if ( date('D') = "mon" ) { $sunday = mktime (0,0,0,date("m") ,date("d")-1,date("Y")); } does anyone know a simple way to do this _ Overloaded with spam? With MSN 8, you can filter it out http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] finding out the date of the first day of the current week
> I am trying to make a small function that will me the date in Y-m-d of the > start of the current week (the sunday) I have only the idea of doing it by > making a long drawn out script with if, elseif clauses for every day of > the > week... and then doing something like > > if ( date('D') = "mon" ) { > > $sunday = mktime (0,0,0,date("m") ,date("d")-1,date("Y")); Try this: $Sunday = mktime(0,0,0,date('m'),date('d')-date('w'),date('Y')); ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php