Questions tagged [nodatime]

Noda Time is a .NET library designed to simplify the correct handling of dates and times in the .NET environment.

Noda Time is an alternative date and time API for .NET. It helps you to think about your data more clearly, and express operations on that data more precisely.

It borrows many concepts from Joda Time, the industry standard date and time handling library for Java. It is an idiomatic port - not a direct translation. It has been specifically tailored for use in the .Net Framework.

There are many reasons to use Noda Time instead of the normal BCL date and time types, including:

  • Support for IANA/Olson time zones such as America/New_York.

  • Distinct representations of different concepts: Instead of using DateTime to represent everything, there are different types for dates, times, values with time zones, values with just UTC offsets, etc.

  • Reduced surprise: All Noda Time types work consistently in a predictable manner. By contrast, the DateTime type has different behaviors depending on its Kind property. For examples of the type of surprises that are avoided, read "What's Wrong with DateTime Anyway?"

  • Testability: You can easily mock the system clock using the IClock interface, and you have to go out of your way if you want to be affected by the computer's local time zone. By contrast, DateTime.Now is difficult to mock, and is bound to the system time zone by default.

Noda Time also has the ability to work with Windows time zones, and can convert between them. It also contains zone.tab data, which can be used to correlate time zones with a country code, or locate time zones on a map.

Resources:

The primary author of Noda Time is Jon Skeet, of Stack Overflow fame.

See also:

452 questions
0
votes
0 answers

Class Library (FluentMigrator) and bindingRedirect

I have a problem whereby some where in my migration, an external library (NodaTime.Serialization.ServiceStackText) method requires the old version of NodaTime to run but my current assembly is using the latest version of NodaTime. I learned that a…
icube
  • 2,578
  • 1
  • 30
  • 63
0
votes
2 answers

Importing list of dates from a timezone with Noda Time

I need to import measured data (one datapoint each hour) and want to represent the dates with noda time. The series is affected by daylight saving transitions - and with those I have some issues. I created some test dates with the daylight saving…
Aaginor
  • 4,516
  • 11
  • 51
  • 75
0
votes
1 answer

nodatime total minutes between times

I have used NodaTime with c# a lot, and it has been fantastic, but was caught out when trying to obtain the total minutes between two LocalDateTimes. My two times are more than a week apart. This does not deliver a valid result: (1) long Mns =…
0
votes
1 answer

NodaTime get time offset

I have Xamarin PCL project and I added NuGet package "NodaTime". Especially I want to get difference of windows server time and my device time. Bu I couldn't find anything about this.
Aybuke
  • 211
  • 2
  • 16
0
votes
1 answer

How to convert DateTime to NodaTime with timezone?

I trying to convert a given DateTime to NodaTime with timezone conversion, for display purposes. Even with 3 different attempts, I cannot get NodaTime to give me the expected results. Here is some sample code (given DateTime dt): //option…
davidkomer
  • 3,020
  • 2
  • 23
  • 58
0
votes
2 answers

Equivalent of joda LocalTime getMillisOfDay() in noda

I am porting some code from Java to .NET and looking for a noda-time equivalent of the getMillisOfDay() joda-time method of the LocalTime object. Is there an equivalent one or must I code my own?
Jon
  • 5,247
  • 6
  • 30
  • 38
0
votes
1 answer

NodaTime ZoneIntervals

I'm attempting to build a logical set of time zone records representing a 5-year period where the stop and start date/time matches to what a person perceives as the time change moment daylight savings is observed. For example, in America/New_York…
J Reynolds
  • 33
  • 1
  • 5
0
votes
1 answer

Convert ZonedDateTime to date representation with zone

I want to represent dates with associated zones, but I didn't found any type to represent the date in Noda time (something similar to the LocalDate, but with zone information, so it would by nice to have a ZonedDate structure). How can I store date…
Dominik Palo
  • 2,873
  • 4
  • 29
  • 52
0
votes
1 answer

NodaTime deserialization of LocalTime results in InsufficientExecutionStackException

From the moment I want to deserialize a NodaTime LocalTime in a WebApi request, I get a InsufficientExecutionStackException... (LocalDate works fine) Insufficient stack to continue executing the program safely. This can happen from having too…
Tom Deleu
  • 1,177
  • 1
  • 15
  • 29
0
votes
1 answer

NodaTime usage for datetimepicker

To avoid label of duplicate here's a brief summary of all what i did. After spending hours of googling to calculate the difference between two dates I came across here and here where, i was convinced to use NodaTime to get difference in terms of…
0
votes
1 answer

How do I filter timezones?

I am creating a web application that will offer the user a list of available timezones. I don't want to see the entire list of timezones, however, because it's long and I don't need anything outside of one or two countries. Is there a way to filter…
damccull
  • 3,908
  • 2
  • 17
  • 22
0
votes
1 answer

Inconsistent Zone Identifiers in Noda

When I check this property... var t = DateTimeZoneProviders.Tzdb.Ids; ...it contains values such as: US/Alaska US/Eastern US/Hawaii US/Pacific US/Arizona America/Denver America/Chicago America/Phoenix America/Los_Angelos But when I access…
Brent Arias
  • 29,277
  • 40
  • 133
  • 234
0
votes
1 answer

Want to display date and time based on timezone id Nodatime

I heard that if I use nodatime library then I can get date & time based on timezone id. first I change my pc date and time. set to old date and time in my pc and then run the below code which disappoint me. using NodaTime; var zoneId =…
Thomas
  • 33,544
  • 126
  • 357
  • 626
0
votes
0 answers

Nodatime: How to parse timezone return by browser by NodaTime Library

this js code return timezone of the client pc.