Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Formatting Syntax of SimpleDateFormat a Java Invention?

Is the syntax of date-time format strings as defined in Java's SimpleDateFormat class (like "EEE, MMM d, ''yy" and such) an original Java invention, or is it based on some other syntax definition like ICU's or CLDR's?!

Is anybody aware of work that compares SimpleDateFormat syntax to those other definitions?

like image 480
ThomasH Avatar asked Sep 03 '15 13:09

ThomasH


People also ask

What is the use of SimpleDateFormat in Java?

SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. It allows for formatting (date -> text), parsing (text -> date), and normalization. SimpleDateFormat allows you to start by choosing any user-defined patterns for date-time formatting.

How do I change date format in SimpleDateFormat?

Java SimpleDateFormat Example String pattern = "MM-dd-yyyy"; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); String date = simpleDateFormat. format(new Date()); System. out. println(date);

What does SimpleDateFormat return?

Return Value: The method returns Date or time in string format of mm/dd/yyyy.


1 Answers

java.text.*, introduced in JDK 1.1., was based on ICU:

ICU was originally developed by the Unicode group at the IBM Globalization Center of Competency in Cupertino, and ICU was contributed to Sun for inclusion into the JDK 1.1. ICU4J includes enhanced versions of some of these contributed classes plus additional classes that complement the classes in the JDK.

ICUs own SimpleDateFormat states that its symbols are based on "algorithm and pattern letters defined by UTS#35 Unicode Locale Data Markup Language (LDML)", which can be found here.

Interestingly the Date-Pattern chapter was introduced into the Unicode Technical Report #35 in Revision 3 from 2004-10-27. Maybe ICU was then the original author?

like image 182
wero Avatar answered Oct 21 '22 13:10

wero