date menace

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
amitnandi
Forum Newbie
Posts: 1
Joined: Mon May 24, 2004 1:52 am
Contact:

date menace

Post 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]
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
Post Reply