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.
ok, thanks for the clarification; im adding /** * Create CalendarDate from msecs since epoch * Uses the given Calendar. * @param cal calendar to use, or null for default * @param msecs milliseconds from 1970-01-01T00:00:00Z * @return CalendarDate in UTC time zone. */ public static CalendarDate of(Calendar cal, long msecs); > Here's the code that works for me: > > public static CalendarDate of(long msecs) { > return of(null, msecs); > } > > /** > * Create CalendarDate from msecs since epoch > * @param msecs milliseconds from 1970-01-01T00:00:00Z > * @return CalendarDate in UTC > */ > public static CalendarDate of(Calendar cal, long msecs) { > // Constructs an instance set to the milliseconds from > 1970-01-01T00:00:00Z using ISOChronology in the specified time zone. > if (cal == null) cal = Calendar.getDefault(); > Chronology chronology = Calendar.getChronology(cal); > DateTime dt = new DateTime(msecs, chronology) ; > return new CalendarDate(cal, dt); > } > > > On 10/27/12 2:28 PM, Unidata netCDF Java Support wrote: > > Unless, the msecs are correctly calculated for that calendar. is that the > > case? > > > >> Hi Don: > >> > >> The problem is that "msecs since <date>" already assumes a calendar. so it > >> doesnt make sense to put it into a calendar AFAIU. Where do you get that > >> msecs from ? > > > > > > Ticket Details > > =================== > > Ticket ID: TVQ-727289 > > Department: Support netCDF Java > > Priority: Normal > > Status: Open > > > > -- > 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: Open