|
Posted by Arno Coetzee on 07/19/05 10:46
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
Navigation:
[Reply to this message]
|