what i need is that "monday" means "monday this week", regardless of whether i ask on monday, tuesday, wednesday, thursday, friday, saturday or sunday. the way php works now, i have to something like this: if(date("l") == "monday") $from = date("Y-m-d"); // if today if monday, just give today's date else $from = date("Y-m-d", strtotime("last monday")); // when asking on tuesday thru sunday it would be nice if strtotime understood the form "monday this week". On 04/07/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
On Wed, 2007-07-04 at 22:14 +0200, Olav Mørkrid wrote: > On 03/07/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote: > > > If that's ALWAYS the case then it sounds like you have all the > > information you need to get the Monday you want :) > > what do you mean? > > php clearly makes a mistake in giving monday of the current week. I don't see how you figure "clearly makes a mistake". For instance the following script illustrates a VERY clear behaviour that doesn't seem mistaken to me, it seems more like a design choice: <?php $days = array ( 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', ); foreach( $days as $day ) { echo date( 'Y-m-d', strtotime( $day ) ).' ('.$day.")\n"; } ?> You'll notice that it always presents the first such date from TODAY ONWARDS. With that in mind it is trivial to get the date YOU want. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php