> where the duration is in a fixed number of seconds, i assume?
Well, in "calendar-aware" libraries like Joda the duration could be a "constant" or it could be one of the variable-length fields. So in Joda-time you can do something like
new DateTime().plusYears(1), which may give a different result from
new DateTime().plusDays(365)
Similarly plusMonths(1) might be different from plusDays(30) of course.
depending on the calendar system in use. If you want to add a fixed interval you can use plusMillis() to add a fixed number of milliseconds.
Jon
-----Original Message-----
From: cf-metadata-bounces at cgd.ucar.edu [mailto:cf-metadata-bounces at cgd.ucar.edu] On Behalf Of John Caron
Sent: 01 April 2011 14:17
To: cf-metadata at cgd.ucar.edu
Subject: Re: [CF-metadata] udunits time units question
On 4/1/2011 5:09 AM, Jon Blower wrote:
> I guess such a library also needs the ability to add and subtract fixed durations to and from reference date/times.
where the duration is in a fixed number of seconds, i assume?
so we have:
CalendarDate d1, d2;
long secs = d1.diff(d2);
d1 = d2.add( secs);
d1 = d2.subtract( secs);
> Also conversion to and from string representations (e.g. ISO8601).
d1 = CalendarDate.parse(isoString);
d1.toString() puts out iso date.
_______________________________________________
CF-metadata mailing list
CF-metadata at cgd.ucar.edu
http://mailman.cgd.ucar.edu/mailman/listinfo/cf-metadata
Received on Fri Apr 01 2011 - 09:05:59 BST