how to store timezone in a table

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
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

how to store timezone in a table

Post by jasongr »

Hello

I have a table which stores an attribute of type DATETIME. I would also like to know what timezone this type represents. Does the DATETIME type implicitly stores the timezone of a value or do I need to store it separately in a separate attribute? If so, what type should the timezone be stored at?

CREATE TABLE time_info (
time DATETIME NOT NULL,
timezone <type ?>
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

regards
Jason
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Post by litebearer »

Generally, the datetime, timestamps etc are based upon the date/time of the server. You could use GMT time to determine what zone a server is in. ie GMT - 5 is EST. Perhaps using that info you can decide what values you want to store.

Lite...
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post by jasongr »

thanks I will keep that in mind
Post Reply