Re: getting timestamp for first day of current week

From: Date: Wed, 04 Jul 2007 20:25:03 +0000
Subject: Re: getting timestamp for first day of current week
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-258279@lists.php.net to get a copy of this message
On Wed, 2007-07-04 at 22:14 +0200, Olav Mørkrid wrote: > On 03/07/07, Robert Cummings <robert@interjinn.com> 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. | `------------------------------------------------------------'

« previous php.general (#258279) next »