[Info-vax] VMS Software Bootcamp 2024

Arne Vajhøj arne at vajhoej.dk
Tue Sep 17 21:02:12 EDT 2024


On 9/17/2024 8:37 PM, Lawrence D'Oliveiro wrote:
> On Tue, 17 Sep 2024 19:40:07 -0400, Arne Vajhøj wrote:
>> On 9/17/2024 7:25 PM, Lawrence D'Oliveiro wrote:
>>> I would say Java in particular is an example of how not to do it.
>>
>> You mean that "HH:mm" and "hh:mm a" are way worse than '%H:%M' and
>> '%I:%M %p' ?
>>
>> :-)
> 
> I mean, look at the mess of classes that makes up the Java date/time API.

That is a bit peripheral to the time formatting issue.

The java.time package added in Java 8 is indeed rather big and
can be hard to navigate.

The old stuff is pretty straightforward.

All one need to know is:

Date = point in time = C time_t

Calendar/GregorianCalendar = conversion between point in time and time 
components = C gmtime/localtime/mktime

DateFormat/SimpleDateFormat = conversion between binary and text 
representation = C strftime/strptime

(the java.time equivalents are Instant, LocalDateTime and
DateTimeFormatter)

Arne








More information about the Info-vax mailing list