This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
The first method was already there, the secnd ive just added. both have this caveat: * NOTE: we are using jodatime patterns right now, but may switch to jsr-310 when thats available in java 8. * Not sure whether these patterns will still work then, so use this formatter at the risk of having to * change it eventually. OTOH, its likely that the same functionality will be present in jsr-310. public CalendarDateFormatter(String pattern) { dflocal = DateTimeFormat.forPattern(pattern).withZoneUTC(); } public CalendarDateFormatter(String pattern, CalendarTimeZone tz) { dflocal = DateTimeFormat.forPattern(pattern).withZone( tz.getJodaTimeZone()); } > > > > Also, for formatting on output, the IDV supports specifying the > > TimeZone. It would be useful to have a method in CalendarDateFormatter > > which would take a custom format string and a timezone, something like: > > > > public static String formattedString(CalendarDate cd, String pattern, > > CalendarTimeZone tz) { > > DateTimeFormatter mydf = > > DateTimeFormat.forPattern(pattern).withZone(CalendarTimeZone.getDateTimeZone()); > > return mydf.print(cd.getDateTime()); > > > > } Ticket Details =================== Ticket ID: TVQ-727289 Department: Support netCDF Java Priority: Normal Status: Open