Class DateParser

java.lang.Object
com.day.cq.dam.commons.util.DateParser

public final class DateParser extends Object
  • Constructor Details

    • DateParser

      public DateParser()
  • Method Details

    • parseDate

      public static Date parseDate(String sDate)
      Try to parse a date using as many methods as possible, until one works.
      Parameters:
      sDate - the date string
      Returns:
      the corresponding date, or null if not parseable or if the date string is empty or null
    • parseRFC822Date

      public static Date parseRFC822Date(String sDate)
      Parse an RFC 822-style date string.
      Parameters:
      sDate - the date string
      Returns:
      the corresponding date, or null if not parseable or if the date string is empty or null
    • parseW3CDate

      public static Date parseW3CDate(String sDate)
      Parse a W3C date string. Not comprehensive.
      Parameters:
      sDate - the date string
      Returns:
      the corresponding date, or null if not parseable or if the date string is empty or null