Forum Moderators: coopster

Message Too Old, No Replies

Date Time UNIX DATE NOW(), TIME() DATE()

Trouble with date php and mysql

         

HeadBut

1:16 pm on Jun 11, 2005 (gmt 0)

10+ Year Member



I'm so confused, I just want to put this: "Sat, 11 Jun 2005 06:10:50 MST" into a mysql date field!

coopster

1:21 pm on Jun 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Why? Why not store the timestamp and format it like this when you pull it out?

HeadBut

1:31 pm on Jun 11, 2005 (gmt 0)

10+ Year Member



mysql seems to want this: 2005-05-22

What functions do most people use to put a date from a POST into mysql? Are most users keeping time in a different field? Seems like it should all fit in one field.

coopster

1:36 pm on Jun 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Depends on how I intend to use it, but DATETIME is most often used for storing Date/Time information for me. I'll use TIMESTAMP once in awhile for record update tracking, but that practice can be argued. In this case, DATETIME seems the best fit.

[dev.mysql.com...]