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 for specific ZonedDateTime
?
For example:
I have a structure of type ZonedDateTime
= 2015/11/11 1:30 AM and I want to store a date part (2015/11/11) of this time with TimeZone from ZonedDateTime
.
I suggest you build your own class or struct that just has the pair of them - or use Tuple<LocalDate, DateTimeZone>
. There's nothing specific for this in Noda Time at the moment, and I don't expect to add it unless we hear this as a feature request more widely.
Another alternative would be to just use ZonedDateTime
and extract the date from it when you need to, probably normalizing to "start of day" (e.g. via DateTimeZone.AtStartOfDay(LocalDate)
) for the sake of equality tests. But I'd personally shy away from that as it implies that there is a time-of-day usefully stored there, which in your case there isn't.
See more on this question at Stackoverflow