Return to site

☕🎓JAVA CERTIFICATION QUESTION: ISO_LOCAL_DATE_TIME

· java,ocp

Given:

What is the output of the given code?

* 2023080871843

* 20230808 184300

* 2023-08-0818:43

* 2023-08-08T18:43

* 2023-08-08 18:43:00

* 2023-08-08T18:43:00

#java #certificationquestion #ocp

Answer: 2023-08-08T18:43:00

Javadoc:

public static final DateTimeFormatter ISO_LOCAL_DATE_TIME

The ISO date-time formatter that formats or parses a date-time without an offset, such as '2011-12-03T10:15:30'.

This returns an immutable formatter capable of formatting and parsing the ISO-8601 extended offset date-time format. The format consists of:

The ISO_LOCAL_DATE

The letter 'T'. Parsing is case insensitive.

The ISO_LOCAL_TIME

The returned formatter has a chronology of ISO set to ensure dates in other calendar systems are correctly converted. It has no override zone and uses the STRICT resolver style.