datetime - Convert a time to specified time zone using C#? -
i'm working on application in c# .net 3.5. have time zone value of user stored in db format (-05:00,1), -5.00 represents est time zone value , 1 indicates time zone follows daylight saving (if 0 not daylight saving zone).
now want convert date time value timezone value considering daylight saving value.
any appreciated. thanks
having offset , whether or not it's in daylight saving time isn't enough indicate time zone: there can several time zones same standard offset , dst offset, have dst transitions @ different times.
is data in database, or still designing it? ideally should store time zone id - ones timezoneinfo
works windows ids, isn't ideal imo (i prefer iana/olson ids rest of industry tends work with) @ least represent real time zone.
once you've got timezoneinfo
, instant want convert, converttimefromutc
, converttimetoutc
you're after - careful mean "any date time value"; need make sure know you're representing.
the bcl woolly on of this, 1 of reasons started noda time, allows use of iana time zone data bcl.
Comments
Post a Comment