| 
	
 | 
 Posted by kalinga on 07/20/05 11:06 
this seems pretty interesting, i'm tring to write a code in php to get 
those two outputs, but bit confused in counting weeks. could somebody 
clear me.. 
 
"what is the first *date* of the first week of year 2005?" 
 
is it "saturday jan 1st 2005" (assuming first week starts from jan 1 
of any year) 
or 
is it "sunday jan 3rd 2005" (assuming first day of a week is monday) 
or 
anything else. 
 
thanks 
 
vk. 
 
 
 
On 7/19/05, Arno Coetzee <arno@flashmedia.co.za> wrote: 
> Philip Thompson wrote: 
>  
> > Hi all. 
> > 
> > I have the week number (for example, this is the 29th week of the 
> > year and it begins on 7/17/05). Does anyone know how to obtain the 
> > first (and maybe the last) date of the week if you only know the week 
> > number of the year? Would it be better for me to obtain this in PHP 
> > or MySQL? or both? 
> > 
> > I have researched the archives on a few lists and I know that others 
> > have asked this same questions, but I have not found a good solution. 
> > I have also looked on MySQL's "date and time functions" page, but had 
> > little luck. 
> > 
> > Any thoughts would be appreciated. 
> > ~Philip 
> > 
> Hi Philip 
>  
> give this a go... i played around with the date functions of mysql 
>  
> select date_sub(curdate() , interval (date_format(curdate() , '%w')-1) 
> day) as firstday , date_add(curdate() , interval (7 - 
> date_format(curdate() , '%w')) day) as lastday 
>  
> it will give you the date of the monday and the sunday of the current week 
>  
> hope this solves your problem. 
>  
> Arno 
>  
> -- 
> PHP General Mailing List (http://www.php.net/) 
> To unsubscribe, visit: http://www.php.net/unsub.php 
>  
>
 
  
Navigation:
[Reply to this message] 
 |