In comp.lang.java.programmer message <
[email protected].
sbc.com>, Sat, 21 Feb 2009 11:04:14, Mark Space
This implies to me that you have two different types of dates, and you
shouldn't be trying to use the same type (java.util.Date) for both.
Indeed, there are two types of date, with an overlap. Or, rather, there
are three types of date.
One type is like the date of Easter, or Christmas, or other Birthdays :
the same date everywhere on the world (Orthodox Christians etc.
disregarded). That can be called a Chronological Date, since it is what
historians use.
The other two are the sort of date which, combined with a time of day
and an offset from UTC, indicates a single absolute instant in a
location-dependent manner; for one, the offset from UTC is the local
clock offset, for the other it is zero regardless of location.
For those whose clocks are never adjusted either for Summer & Winter or
to agree with [different] neighbours, either can be used, though it's
not reasonable to use a local date for non-local purposes.
Otherwise, one should use local dates for local events, UTC dates for
events not associated with a terrestrial locality, and Chronological
dates for ordinary life where clock changes either do not occur or can
be disregarded.
A system that handles only dates can be considered as, and implemented
by, a system that handles UTC date/time with time=00:00:00. One can
also use UTC methods to handle local date/time whenever the offset can
be disregarded - but then, ignoring Jet Stream effects, flying across
the Atlantic takes eight or ten hours longer Eastbound than Westbound.
UTC methods should be faster than local methods, because there os no
offset from UTC to be determined.
If necessary, it is easy enough to write code, using just general-
purpose programming operations, to convert between Year-Month-Day and
daycount. and to do input, output, and validation; methods, albeit not
Java, are via sig.
My anchor <URL:
http://www.merlyn.demon.co.uk/estr-bcp.htm#TNS>
is immediately preceded by Easter code in JavaScript,
Pascal/Delphi, and C; I'd be pleased to add a good Java
version.