We help IT Professionals succeed at work.

Multiple Date Parsers

oleber
oleber asked
on
273 Views
Last Modified: 2010-03-30
Hy all

I getting multiple dates from the net and each has a different format.

In Perl is ease to parse this dates, in reality, many different packages do it.

But I'm needing to do this in Java, I have dates like:

Sun, 19 May 2002 15:21:36 GMT
2007-10-07T14:43:00Z
2007/02/05
200603251524

And many others. so isn't easy to get a simple format to all of them. Is there a intelligent package in Java that get any of this dates and returns me the number of seconds since epoc, without the need of suppling a date from my side?

Thanks
Oleber
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
Nothing other than trying multiple DateFormat. It would be better to constrain input
CERTIFIED EXPERT
Top Expert 2016

Commented:

Author

Commented:
I'd like to have always the some format, but I'm collecting data from different sources that we don't control. In this XML exists a field that is a data, the only problem is that different sources fill the date in different formats.

Clearly, I'm trying to avoid this solution, it isn't generic enough.

So the question continues: Is there a Generic Package (don't need to be a from SUN) that parses multiple format dates?

+- the same as Date::Manip or Date::Calc, ... from Perl.

Thanks
Oleber
CERTIFIED EXPERT
Top Expert 2016

Commented:
Any package would simply have to try different date formats. You would be better off tailor making one for your own variations
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.