4 ms·
Java: new java.text.SimpleDateFormat("YYYY-MM-dd").parse("2018-12-30") returns Sun Dec 31 2017 new java.text.SimpleDateFormat("YYYY-MM-dd").format(new java.ut
by hafthor 8y ago
Java:
new java.text.SimpleDateFormat("YYYY-MM-dd").parse("2018-12-30") returns Sun Dec 31 2017
new java.text.SimpleDateFormat("YYYY-MM-dd").format(new java.util.Date("12/30/2018")) returns 2019-12-30
java.time from Java8 also affected.
java.time.format.DateTimeFormatter.ofPattern("YYYY-MM-dd").format(java.time.LocalDate.parse("2018-12-30")) returns 2019-12-30
- adamvoncorswant 8y agoIsn't it fun that while we're all discussing 'yyyy' vs 'YYYY', it sees like we're missing out that what everyone actually should use most of the time is rather 'uuuu'?
- lstamour 8y agouuuu appears to be Java-specific: https://stackoverflow.com/questions/41177442/uuuu-versus-yyyy-in-datetimeformatter-formatting-pattern-codes-in-java https://stackoverflow.com/questions/41177442/uuuu-versus-yyy...
- adamvoncorswant 8y agoYes, indeed so. That's why I answered in the java thread. Sorry for not making that clear.
- bassman9000 8y agoJavadoc uses yyyy for year since at least 1.5 https://docs.oracle.com/javase/1.5.0/docs/api/java/text/SimpleDateFormat.html https://docs.oracle.com/javase/1.5.0/docs/api/java/text/Simp... I've never seen YYYY used in Java.