Kannan Lg
Kannan Lg

Reputation: 921

Choosing data type for date and time in mysql

I have a table which will have a date/time column to store create date of the post. what should be the datatype of the column? i found a lot of types like timestamp, date, datetime and so on.
Which one is more compatible (in terms of time conversions) with php and javascript. how do i convert a mysql date/time to php date/time to javascript date/time?

How do i consider/include the timezone aspect with the time?

Upvotes: 0

Views: 314

Answers (1)

redmoon7777
redmoon7777

Reputation: 4526

If your application is going to be dealing with time zones, You would be better using timestamp. This will ensure that all the dates are stored in UTC time and will be converted to the current time zone upon retrieval.

Upvotes: 5

Related Questions