public class DateFromString extends Object
| Constructor and Description | 
|---|
| DateFromString() | 
| Modifier and Type | Method and Description | 
|---|---|
| static Date | getDateUsingCompleteDateFormat(String dateString,
                              String dateFormatString)Parse the given date string using the given date format string (as
 described in java.text.SimpleDateFormat) and return a Date. | 
| static Date | getDateUsingCompleteDateFormatWithOffset(String dateString,
                                        String dateFormatString,
                                        int startIndex)Parse the given date string (starting at the given startIndex) using the
 given date format string (as described in java.text.SimpleDateFormat) and
 return a Date. | 
| static Date | getDateUsingDemarkatedCount(String dateString,
                           String dateFormatString,
                           char demark)Parse the given date string, starting at a position given by the offset of the demark character in the
 dateFormatString. | 
| static Date | getDateUsingDemarkatedMatch(String dateString,
                           String dateFormatString,
                           char demark)Parse the given date string (between the demarcation characters)
 using the given date format string (as described in
 java.text.SimpleDateFormat) and return a Date. | 
| static Date | getDateUsingRegExp(String dateString,
                  String matchPattern,
                  String substitutionPattern)Use regular expression capture group replacement to construct a date
 string and return the Date that is obtained by parseing the constructed
 date string using the date format string "yyyy-MM-dd'T'HH:mm". | 
| static Date | getDateUsingRegExpAndDateFormat(String dateString,
                               String matchPattern,
                               String substitutionPattern,
                               String dateFormatString)The same as getDateUsingRegExp() except the date format string to be used
 must be specified. | 
| static Date | getDateUsingSimpleDateFormat(String dateString,
                            String dateFormatString)Parse the given date string (starting at the first numeric character)
 using the given date format string (as described in
 java.text.SimpleDateFormat) and return a Date. | 
public static Date getDateUsingCompleteDateFormat(String dateString, String dateFormatString)
dateString - the String to be parseddateFormatString - the date format Stringpublic static Date getDateUsingCompleteDateFormatWithOffset(String dateString, String dateFormatString, int startIndex)
dateString - the String to be parseddateFormatString - the date format StringstartIndex - the index at which to start parsing the date stringpublic static Date getDateUsingDemarkatedCount(String dateString, String dateFormatString, char demark)
Example: dateString = wrfout_d01_2006-07-06_080000.nc dateFormatString = wrfout_d01_#yyyy-MM-dd_HHmmThis simply counts over "wrfout_d01_" number of chars in dateString, then applies the remaining dateFormatString.
dateString - the String to be parseddateFormatString - the date format Stringdemark - the demarkation characterpublic static Date getDateUsingDemarkatedMatch(String dateString, String dateFormatString, char demark)
Example: dateString = /data/anything/2006070611/wrfout_d01_2006-07-06_080000.nc dateFormatString = #wrfout_d01_#yyyy-MM-dd_HHmm would extract the date 2006-07-06T08:00 dateString = /data/anything/2006070611/wrfout_d01_2006-07-06_080000.nc dateFormatString = yyyyMMddHH#/wrfout_d01_# would extract the date 2006-07-06T11:00
dateString - the String to be parseddateFormatString - the date format Stringdemark - the demarkation characterpublic static Date getDateUsingRegExp(String dateString, String matchPattern, String substitutionPattern)
dateString - the String to be parsedmatchPattern - the regular expression String on which to match.substitutionPattern - the String to use in the capture group replacement.public static Date getDateUsingRegExpAndDateFormat(String dateString, String matchPattern, String substitutionPattern, String dateFormatString)
dateString - the String to be parsedmatchPattern - the regular expression String on which to match.substitutionPattern - the String to use in the capture group replacement.dateFormatString - the date format string to use in the parsing of the date string.public static Date getDateUsingSimpleDateFormat(String dateString, String dateFormatString)
dateString - the String to be parseddateFormatString - the date format String