|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.nc2.units.DateFromString
public class DateFromString
Convenience routines for parsing a String to produce a Date.
Constructor Summary | |
---|---|
DateFromString()
|
Method Summary | |
---|---|
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. |
static Double |
getHourUsingDemarkatedMatch(String hourString,
String formatString,
char demark)
|
static void |
main(String[] args)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateFromString()
Method Detail |
---|
public static Date getDateUsingSimpleDateFormat(String dateString, String dateFormatString)
dateString
- the String to be parseddateFormatString
- the date format String
public 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 simple 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 character
public 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 character
public static Double getHourUsingDemarkatedMatch(String hourString, String formatString, char demark)
public static Date getDateUsingCompleteDateFormat(String dateString, String dateFormatString)
dateString
- the String to be parseddateFormatString
- the date format String
public 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 string
public 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 void main(String[] args) throws ParseException
ParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |