Forum Moderators: coopster

Message Too Old, No Replies

Mysql Datetime confusion

INSERT Doesn't work with SELECT!

         

HeadBut

8:43 pm on Jul 31, 2005 (gmt 0)

10+ Year Member



I've been sitting here all morning testing this thing! :(
I have a MYSQL DATETIME field in a small table. The INSERT function UNIX_TIMESTAMP() doesn't give me a date or time?
UNIX_TIMESTAMP(NOW()) doesn't give me a time?
The SELECT UNIX_TIMESTAMP(CreationDateTime) AS CreationDateTime seems to work but only if I format the date manually with phpmyadmin.
SO, what are most people doing... is there a good php solution?
I'm looking for a reliable INSERT with a reliable SELECT.

Thanks
Matt

Rinso

10:04 pm on Jul 31, 2005 (gmt 0)

10+ Year Member



Not really understand, but I think you have to try

NOW() in your query. It will give the date and time.

It's faster then using date time function from outside php function.

HeadBut

10:12 pm on Jul 31, 2005 (gmt 0)

10+ Year Member



UNIX_TIMESTAMP(NOW()) doesn't give me a time, only gives me the Date portion(2005-07-31) and the time portion is 00:00:00.

Rinso

10:14 pm on Jul 31, 2005 (gmt 0)

10+ Year Member



Try only NOW() without UNIX_TIMESTAMP()