I have a ZonedDateTime and I want to display it such that the datetime is formatted with the short date and short time configured on the workstation followed by the offset (something like... 05/01/2005 02:30 PM -05:00). I expected something like this would work...
var patternDateTimeOffset =
ZonedDateTimePattern.CreateWithCurrentCulture("g o<m>", DateTimeZoneProviders.Tzdb);
lblOriginalDateTimeAndOffsetVal.Text = patternDateTimeOffset.Format(zonedDateTime);
BUT, it appears that the "g" is not supported in ZonedDateTimePattern the way it is in LocalDateTimePattern. The code above throws a NodaTime.Text.InvalidPatternException.
I could replace the "g" with "MM/dd/yyyy hh:mm", but then it's not using the current culture.
I could use a LocalDateTimePattern for the datetime and then concatenate the offset using the ZonedDateTimePattern. This works, but seems ugly.
This seems like a pretty common thing. I'm new to NodaTime, so I'm certain I'm missing something. I'm using NodaTime 1.3.1 and targeting .net 4.0. Any help is appreciated.