c# 4.0 - How to tell if it's British Summer Time in C# -
i have next code, should homecoming offset of 60 (to show in uk @ present, in british summer time - ie. 60 minutes ahead of gmt):
var info = timezoneinfo.findsystemtimezonebyid("greenwich standard time"); datetimeoffset localservertime = datetimeoffset.now; double off = localservertime.offset.totalminutes; homecoming off;
however, returns 0.
could please help prepare me?
thank you, mark
use timezoneinfo.isdaylightsavingtime method (datetimeoffset) find if daylight saving timezone.
var info = timezoneinfo.findsystemtimezonebyid("greenwich standard time"); datetimeoffset localservertime = datetimeoffset.now; bool isdaylightsaving = info.isdaylightsavingtime(localservertime);
there farther examples here
c# c#-4.0
No comments:
Post a Comment