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.
added both; pushed to git > John- > > One more useful method would be CalendarDate.getMillis() which would > return the milliseconds. Since I have to convert from CalendarDate to > value and vice versa, it would help. It could call > DateTime.getInstant().getMillis(). Right now I have to call > CalendarDate.toDate().getTime() to get them, but since you've deprecated > toDate() I'd rather find some other option. > > Thanks. > > Don > > On 10/28/12 3:39 PM, Unidata netCDF Java Support wrote: > > just pushed all this to target-4.3.14 in case you can test. thanks. > > > >> 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: Closed > > > > -- > Don Murray > NOAA/ESRL/PSD and CIRES > 303-497-3596 > http://www.esrl.noaa.gov/psd/people/don.murray/ > > Ticket Details =================== Ticket ID: TVQ-727289 Department: Support netCDF Java Priority: Normal Status: Closed