Well aware of performance and thread issues with SimpleDateFormat, I decided to go with FastDateFormat, until I realized that FastDateFormat is for formatting only, no parsing!
Is there an alternative to FastDateFormat, that is ready to use out of the box and much faster than SimpleDateFormat?
I believe FastDateFormat is one of the faster ones, so anything that is about as fast would do.
Just curious , any idea why FastDateFormat does not support parsing? Doesn’t it seriously limit its use?
At a best guess, it’s to keep FastDateFormat… well… fast, by limiting it to display only.
Apache Commons
DateUtilshas aparseDatefunction, but that usesSimpleDateFormatinternally.An alternative is to use the JodaTime library. It’s a complete replacement for dealing with
DateFormat,Date, andCalendarobjects.JodaTime has a
DateTimeFormatterthat can be used to createDateTimeobjects (JodaTime’s equivalent of Java’sDateobjects) from strings.An example of how to use it is like this:
I don’t know if this is really any faster than
SimpleDateFormat, though.