You are here: Re: MySQL Date comparison « All PHP « IT news, forums, messages
Re: MySQL Date comparison

Posted by MS on 06/08/06 13:48

> Hi All, i want to check if a date is in between two other dates. like
> prevDate < testDate < nextDate. What is the query for this?

The answer depends on how your date is stored. If its stored as a timestamp
then

$result = ("SELECT * FROM tablename
WHERE ((date > '".$prevdate."') && (date < '".$nextdate."'))");

if you have a date in a date format i.e.... dd-mm-yyyy

you will need to rearrange the format into yyyymmdd and then dates are able
to be sorted in chronological order and the < and > operators will work !!

--
----------------------------------------------------------------------------
http://www.myclubweb.co.uk - The Home of Club Websites
----------------------------------------------------------------------------

 

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

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