开发者

datatype for storing timezones

开发者 https://www.devze.com 2023-03-03 12:31 出处:网络
I want to store timezones but not in the开发者_StackOverflow中文版 timezoneoffset datatype. Should I use a decimal or a float? Or something else? Timezones can be GMT -3.5 for NewFoundland or +5.5 for

I want to store timezones but not in the开发者_StackOverflow中文版 timezoneoffset datatype. Should I use a decimal or a float? Or something else? Timezones can be GMT -3.5 for NewFoundland or +5.5 for parts of India so int wouldn't work.


Why not use a lookup table? It would look like this:

create table TimeZone (
    id int identity primary key,
    name varchar(50),
    offset decimal(2,1)
)

With a foreign key reference from your main table.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号