Shub
Shub

Reputation: 265

Storing timezone in mysql date format

I want to store the current timezone in the mysql date datatype. For example,

10-Apr-2014 10:12:41 IST

What i want is: DATE_FORMAT('10-Apr-2014 10:12:41 IST','%d-%b-%Y %H:%i:%S **timezone**')

I searched the DATE_FORMAT and STR_TO_DATE formats but I didn't find any mention of the timezone.

Is there any way I will be able to do this?? I want the IST to appear at the end of date and time! Please help!

Upvotes: 0

Views: 772

Answers (1)

dezlov
dezlov

Reputation: 850

MySQL does not have a dedicated data type for storing timezone information.

You have a choice of either:

  1. Store timezone in a separate field (additional table column), the preferred way
  2. Store the date, time and timezone as a VARCHAR, but this will make SQL queries based on date and time much harder and slower.

Upvotes: 1

Related Questions