nodatime

DateTime.Now and Culture/Timezone specific

十年热恋 提交于 2019-11-27 05:13:02
问题 Our application was designed to handle user from different Geographic location. We are unable to detect what is the current end user local time and time zone operate on it. They select different culture like sv-se, en-us, ta-In even they access from Europe/London timezone.. We hosted it in a hosting server in US, application users are from Norway/Denmark/Sweden/UK/USA/India The problem is we used DateTime.Now to store the record created/updated date, etc. Since the Server runs in USA all user

How can NodaTime be used with EF Code First?

笑着哭i 提交于 2019-11-26 22:37:24
问题 I really want to be able to use NodaTime in my Entity Framework Code First database projects but haven't found a "clean" way to do it. What I really want to do is this: public class Photoshoot { public Guid PhotoshootId{get; set;} public LocalDate ShootDate{get; set;} //ef ignores this property } Is there any supported or recommended approach to using NodaTime with EF Code First? 回答1: Until custom primitive type persistence is natively supported in Entity Framework, a common work around is to

How should I populate a list of IANA / Olson time zones from Noda Time?

吃可爱长大的小学妹 提交于 2019-11-26 22:12:20
I am using NodaTime in an application, and I need the user to select their timezone from a dropdown list. I have the following soft requirements: 1) The list only contain choices that are reasonably valid for the present and near future for real places. Historical, obscure, and generic timezones should be filtered out. 2) The list should be sorted first by UTC offset, and then by timezone name. This hopefully puts them in an order that is meaningful for the user. I've written the following code, which does indeed work, but doesn't have exactly what I'm after. The filter probably needs to be

How does DateTimeOffset deal with daylight saving time?

夙愿已清 提交于 2019-11-26 15:51:55
问题 I am storing schedules in the database as a day of the week, hour and minute. When the data is read we create a DateTime object for the next occurrence of that day, hour and minute, but I need to modify this to be DST-aware. I am able to modify the database if necessary. I know that DateTimeOffset stores a UTC date/time and an offset. I also know from this MSDN blog entry that DateTimeOffset should be used to "Work with daylight saving times". What I'm struggling to understand is exactly how

How should I populate a list of IANA / Olson time zones from Noda Time?

妖精的绣舞 提交于 2019-11-26 08:13:51
问题 I am using NodaTime in an application, and I need the user to select their timezone from a dropdown list. I have the following soft requirements: 1) The list only contain choices that are reasonably valid for the present and near future for real places. Historical, obscure, and generic timezones should be filtered out. 2) The list should be sorted first by UTC offset, and then by timezone name. This hopefully puts them in an order that is meaningful for the user. I\'ve written the following

How to translate between Windows and IANA time zones?

孤街醉人 提交于 2019-11-25 22:43:46
问题 As described in the timezone tag wiki, there are two different styles of time zones. Those provided by Microsoft for use with Windows and the .Net TimeZoneInfo class (when running on Windows) are identified by a value such as \"Eastern Standard Time\" . Those provided by IANA in the TZDB, and used by the .NET TimeZoneInfo class when running on Linux or OSX, are identified by a value such as \"America/New_York\" . Many Internet-based APIs use the IANA time zones, but for numerous reasons one