Reply to Re: querying dates in Mysql

Your name:

Reply:


Posted by Felix Geerinckx on 09/14/05 10:54

On 14/09/2005, NC wrote:

> toedipper wrote:
>
> > Is there any way in Mysql to work out the start of the
> > current week?
>
> Not that I know of

If your week starts on Monday:

SELECT
CURRENT_DATE - INTERVAL (5 + DAYOFWEEK(CURRENT_DATE)) MOD 7 DAY;

If your week starts on Sunday:

SELECT
CURRENT_DATE + INTERVAL 1 DAY - INTERVAL DAYOFWEEK(CURRENT_DATE) DAY;

--
felix

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация