[threeten-dev] DateTime interface

Stephen Colebourne scolebourne at joda.org
Thu Dec 13 07:42:04 PST 2012


Looking at it again, the DateTime interface is not that well named.

Each of the following are implementations of DateTime:

DateTime a = LocalDateTime.now()
DateTime b = ZoneDateTime.now()
DateTime c = LocalDate.now();
DateTime d = LocalTime.now();
DateTime e = Insant.now();
DateTime f = ZoneOffset.UTC;

While LocalDateTime and Zone[d]DateTime make sense, the others make
far less sense.

Why does LocalDate implement DateTime when it has no time?
Why does ZoneOffset implement DateTime when it has neither a date nor time?

The purpose of the interface is to effectively represent common access
to some part of the date/time domain.

For a long time, the name was Calendrical, but that wasn't much liked.
Some alternatives:
- Calendrical
- Calend
- Moment
- TimeAspect
- Temporal

Personally, I think "temporal" is pretty good. It means "of or
relating to time".

Other suggestions welcome, although change is not yet certain.

Note that there are some other related interfaces:
- DateTimeAccessor
- DateTimeField
- PeriodUnit

Some or all of these might also make sense to consider.

Stephen


More information about the threeten-dev mailing list