You are here: Re: how do you get a list of all dates between two dates more than a day apart? « PHP Programming Language « IT news, forums, messages
Re: how do you get a list of all dates between two dates more than a day apart?

Posted by Jerry Gitomer on 01/21/06 06:09

Notgiven wrote:
> Say you have two dates, 2005-01-01 and 2005-01-24. I want to get a list or
> array or all the date between and including those two dates.
>
> I want to include this list in a query so I need it in a format like:
> '2005-01-01', '2005-01-02',...
>
> Any ideas? thanks
>
>
Since you are planning to use the dates in a query (assuming you meant
a database query) there is no need to get a list of the dates. Use the
BETWEEN operator in your WHERE clause. For example to select all of the
dates in January 2005 you can use the following in your queries WHERE
clause:

WHERE data_date BETWEEN '2005-01-01' AND '2005-01-31'

HTH

Jerry

 

Navigation:

[Reply to this 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

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