Package org.docx4j.model.fields
Class DateFormatInferencer
java.lang.Object
org.docx4j.model.fields.DateFormatInferencer
public class DateFormatInferencer
extends java.lang.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 Summary
Constructors Constructor Description DateFormatInferencer() -
Method Summary
Modifier and Type Method Description static java.lang.StringdetermineDateFormat(java.lang.String dateString)Determine SimpleDateFormat pattern matching with the given date string.static voidmain(java.lang.String[] args)
-
Constructor Details
-
DateFormatInferencer
public DateFormatInferencer()
-
-
Method Details
-
determineDateFormat
public static java.lang.String determineDateFormat(java.lang.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:
SimpleDateFormat
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-