Class DateFormatInferencer

java.lang.Object
org.docx4j.model.fields.DateFormatInferencer

public class DateFormatInferencer extends Object
From http://stackoverflow.com/questions/3389348/parse-any-date-in-java with modifications for locale See http://stackoverflow.com/questions/3307330/using-joda-date-time-api-to-parse-multiple-formats for similar in Joda
  • Constructor Details

    • DateFormatInferencer

      public DateFormatInferencer()
  • Method Details

    • determineDateFormat

      public static String determineDateFormat(String dateString)
      Determine SimpleDateFormat pattern matching with the given date string. Returns null if format is unknown. You can simply extend DateUtil with more formats if needed.
      Parameters:
      dateString - The date string to determine the SimpleDateFormat pattern for.
      Returns:
      The matching SimpleDateFormat pattern, or null if format is unknown.
      See Also:
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception