Page 1 of 1

date menace

Posted: Mon May 24, 2004 1:52 am
by amitnandi
Hi members,
I hav got a problem as below.
I am storing current timestamp in a field called dDate using time() function. This will take into consideration the current date and the time.
I want to run a sql query to select a record, which has been inserted on a specific date ( say 20/5/2004). Here the date filter is specified in dd/mm/yyyy format. As no time value is specified. The records i want to filter may have been inserted at any time on say 20/5/2004. If i want to list all the records entered on this perticular date how should i write the query. [mysql_man][/mysql_man]

Posted: Mon May 24, 2004 5:12 am
by malcolmboston
to be honest althought it may be a bit of a mess around this is one of mant problems with the MySQL timestamp and the 1 reason i no longer use it

i recommend ->

change your dDate field into a 20 int and insert a 'normal' timestamp

for eg.

Code: Select all

$timestamp = time();
then insert $timestamp into that field into MySQL, you can now format it with teh date function and it makes it much easier for seacrhing MySQL and stops various problems with DATE FORMAT

my $0.02

good luck