Update: Now it will be in Noda Time 2.3.
No, there is nothing like that in Noda. This is a rather strange value, since, at least in many time zones, the offset will change throughout the year. I understand that sometimes we need to work with what we have.
I would save it as two fields: Offset and LocalTime . Then you can create OffsetDateTime when you have LocalDate . You can get these two via OffsetDateTime , as you already do, but I would suggest dividing it into two values as soon as possible to avoid a hint that there is a useful date.
If you want to preserve the existing code structure, you can at least make it a lot easier:
// The date for this OffsetDateTime will be 1/1/2000 // Note: the pattern can be created once and reused; it thread-safe. var parsed = OffsetDateTimePattern.CreateWithInvariantCulture("HH:mm:sso<G>") .Parse(input).Value; var desiredLocalDate = new LocalDate(2017, 06, 13); var adjusted = desiredLocalDate.At(parsed.TimeOfDay).WithOffset(parsed.Offset); var localTime = adjusted.LocalDateTime;
Note that LocalTime here will always be equivalent to desiredLocalDate.At(parsed.TimeOfDay) - this is not the way an offset is added to it.
source share