How to store TimeZoneInfo objects in a database?

后端 未结 4 1195
旧巷少年郎
旧巷少年郎 2021-02-13 07:02

Somewhat misleading title, I know. Never actually wanted to store TimeZoneInfo object themselves: rather, I want to store some culture-neutral identifier, which can

4条回答
  •  走了就别回头了
    2021-02-13 07:29

    I simply used TimeZoneInfo.Id.GetHashCode(). According to tests, this generates unique integer ID's that can be stored in a DB. You can also build a Dictionary with keys being these hash codes and values being the original ID strings to make reverse lookup easier.

提交回复
热议问题