Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to FastDateFormat for efficient date parsing?

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?

like image 307
Tom Tucker Avatar asked Dec 27 '10 20:12

Tom Tucker


People also ask

What can I use instead of SimpleDateFormat?

DateTimeFormatter is a replacement for the old SimpleDateFormat that is thread-safe and provides additional functionality.

Which class can be use of parsing date?

Parsing is conversion of String into a java. util. Date instance. We can parse a string to a date instance using parse() method of the SimpleDateFormat class.

What is parsing date in Java?

The java. text package provides a class named SimpleDateFormat which is used to format and parse dates in required manner (local). One of the constructors of this class accepts a String value representing the desired date format and constructors SimpleDateFormat object. The format() method of this class accepts a java.


1 Answers

Note that since commons-lang 3.2, FastDateFormat supports parsing as well as printing.

See: http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/FastDateFormat.html

like image 62
Gareth Avatar answered Sep 23 '22 03:09

Gareth