C# british summer time (BST) timezone abbreviation

后端 未结 3 1407
情歌与酒
情歌与酒 2021-01-07 22:04

I need to display a label with the current time zone abbreviation. My pc\'s timezone is currently set to \"(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London\".

相关标签:
3条回答
  • 2021-01-07 22:19

    I think you have two choices: Special case handling for the GMT time zone, or generalized handling for "Time zones for which Microsoft uses an incorrect name."

    I wonder, for example, whether the Portuguese use "GMT" for their time zone in the winter. Whether they do or not, I doubt they use "British Summer Time" in the summer!

    0 讨论(0)
  • 2021-01-07 22:24

    You should know that all the time zones that say "Standard" will properly switch to daylight time in the summer. For example TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time") will be an object that can properly handle both standard and daylight times. The same is true for, say, "Pacific Standard Time".

    0 讨论(0)
  • 2021-01-07 22:35

    The TimeZoneInfo class referrers to "British Summer Time" as "GMT Daylight Time", so no it is not possible. If Microsoft were to store it as "BST" it would be in the DaylightName property.

    Whilst following the development of the TimeZoneInfo class on the BCL blog many years ago, I saw no explanation behind how they chose the values for DaylightName. If I were to guess it would be because this is for a "Time Zone" and not a particular city.

    It appears that the public-domain tzdatabase, which is considered to be more complete than Microsoft's time zone database, does display BST for London (source). This is because Cities are included in this dataset, not just the Time Zones. There is a Project called Noda Time that brings the tzdatabase to .Net that is now avaialble.

    0 讨论(0)
提交回复
热议问题