sql - CURRENT_UTC_TIME and timezone issues -



sql - CURRENT_UTC_TIME and timezone issues -

i hope understand , help me.

my sql server in south africa(gmt+2)

my application in usa (gmt-6)

my client(mobile) in south africa, in brazil (gmt-4).

the lastupdatetime of record in table supposed 10:25am while client time 4:25am. @ time server indicates 2:25am (or that)

i taught can utilize getutcdate function in sql insertions. questions are:

how convert old records' lastupdatetime utc date automatically?

is conversion thought or may in application?

how can allow config of server timezone in web.config file appsetting section (this in order mention every time server timezone changes)?

there 2 different ways acceptable store value lastupdatetime:

in terms of utc, in datetime or datetime2 field in terms of local time, in datetimeoffset field

if you've stored local time in datetime field, value potentially ambiguous. conversion utc require external knowledge of how original info captured.

if values captured sql's getdate statement, time zone of sql server relevant. south africa's time utc+02:00, can either:

keep value in same field , subtract 2 hours adjust utc or, re-create value datetimeoffset field, leaving orignal value , using utc+02:00 offset.

however, if value obtained in time zone, need know time zone was. might run problems daylight saving time, many time zones not fixed single offset.

you said application in usa gmt-6, doesn't create sense. central time in usa alternates between utc-06:00 , utc-05:00, while mount time in alternates between utc-07:00 , utc-06:00. you'll need know time zone was, , you'll have prepared potential overlap due fall-back daylight saving time transition.

with regards whether web.config file - that's more of asp.net question, rather sql server one. however, can tell there's no magic config setting this. application must correctly utilize datetime datetimekind.utc, or utilize datetimeoffset, , may need involve timezoneinfo conversions. it's impossible offer improve advice here, because haven't shown code , broad topic.

sql sql-server timezone

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -