Loading ...
Sorry, an error occurred while loading the content.

43Re: ISO8601 parser/formatter for Java

Expand Messages
  • Aron Roberts
    Mar 3, 2000
      In the message "ISO8601 parser/formatter for Java", dated 2000-03-02,
      Craig Pratt <pratt@...> wrote:

      >I have not been able to find a package/class for Java that contains a
      >parser that can parse a 8601 date/time string.
      >
      >The Java SimpleDateFormat will allow you to specify a particular
      >format - but not one that recognizes the various 8601 formats. e.g.
      >parse "2000-03-01T01:00:00", "2000-03-01", "20000
      >301T01:00:00-09:00", etc. without basically doing a complete
      >pre-parse.
      >
      >Anyone know of a Java class for this? I can't be the first person to
      >run into this.

      In a search of the Google Internet search engine today, the closest
      I was able to come -- at least in 10 minutes of searching -- are the
      Java classes "hplb.misc.Time" and "hplb.util.Cal", described at:

      http://www-uk.hpl.hp.com/people/ak/java/doc/hplb.misc.Time.html
      http://www-uk.hpl.hp.com/people/ak/java/doc/hplb.util.Cal.html

      and which are cached, respectively, by Google at:

      <URL:http://www.google.com/search?q=cache:www-uk.hpl.hp.com/people/ak/
      java/doc/hplb.misc.Time.html>
      <URL:http://www.google.com/search?q=cache:www-uk.hpl.hp.com/people/ak/
      java/doc/hplb.util.Cal.html>

      These classes include methods for generating ISO 8601 date or
      date/time strings from other time/date values.

      This does not solve Craig's problem of finding a Java class that
      contains methods for parsing the various ISO 8601 date/time formats
      in a text string. Nonetheless, it's possible that the author of
      these classes, Anders Kristensen, might have developed other parsing
      routines, as well.

      (This UK-based site was unreachable today, so it was somewhat
      awkward to view its pages via the Google cache, including the full
      list of classes and interfaces on this site at
      <URL:http://www.google.com/search?q=cache:http://www-uk.hpl.hp.com/peo
      ple/ak/java/doc/tree.html>.)

      As an alternative, the "Date::Manip" module for Perl includes a
      flexible parsing routine that handles a variety of ISO 8601 dates,
      ParseDateString():

      http://www.engelschall.com/ar/perldoc/pages/module/Date::Manip.html

      If this routine comes with full Perl source, this might serve as
      handy pseudo-code for someone developing Java methods to parse ISO
      8601 strings. (If the Perl source makes use of regular expressions,
      then the equivalent regex capabilities would obviously need to be
      present in the Java environment. Unfortunately, I know very little
      about Java ...)

      Aron Roberts Workstation Software Support Group . 221 Evans Hall
      University of California, Berkeley, CA 94720-3808 USA
      aron@... . (510) 642-5974 . fax (510) 643-5385
    • Show all 2 messages in this topic