Multiple Date Parsers

Posted on 2007-10-08
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

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?

Question by:oleber
    LVL 86

    Expert Comment

    Nothing other than trying multiple DateFormat. It would be better to constrain input
    LVL 86

    Expert Comment

    LVL 10

    Author Comment

    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.

    LVL 86

    Expert Comment

    Any package would simply have to try different date formats. You would be better off tailor making one for your own variations
    LVL 92

    Accepted Solution


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Receive file in Servlet 1 28
    bunnyEars challenge 6 46
    countAbc challenge 9 35
    where is session ID cache stored 1 27
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    This video teaches viewers about errors in exception handling.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now