Re: dates in MYSQL

From: Date: Wed, 17 Apr 2002 09:46:50 +0000
Subject: Re: dates in MYSQL
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18593@lists.php.net to get a copy of this message
Alex, > I am trying to automatically drop events from a noticeboard when the date > has passed. I have stored the date of the event in the database in the form > YYYY-MM-DD and wish to SELECT From the database WHERE date >= todays date. > Is this possible or do I need to INSERT todays date into the database first. Manual reference: 6.3.4 Date and Time Functions If you are wanting to SELECT (or DELETE) expired entries then wouldn't the logic be: WHERE date < today's date If your questions are to do with handling data in the date data-type, then the answers are yes - you can compare dates in this format; and no - you don't need to put today's date into the db/tbl merely to be able to perform a comparison. Look up NOW() (and its various alternative names/forms) which returns the system date/today's date. Thus: WHERE dateColNm >= NOW() Ok? =dn

« previous php.db (#18593) next »