public class DateParser extends Object
| Constructor and Description |
|---|
DateParser() |
| Modifier and Type | Method and Description |
|---|---|
static CSLDate |
toDate(String dateString)
Converts a given date string to a
CSLDate object. |
static CSLDate |
toDate(String year,
String month)
Parses the given year and month to a
CSLDate object. |
static CSLDate |
toDateRange(String year,
String month)
Parses the given year and month to a
CSLDate object. |
static CSLDate |
toDateSingle(String year,
String month)
Parses the given year and month to a
CSLDate object. |
static int |
toMonth(String month)
Parses the given month string
|
public static CSLDate toDate(String dateString)
CSLDate object. Does
not parse the string but saves it in the CSLDate's raw field.dateString - the stringCSLDate objectpublic static CSLDate toDate(String year, String month)
CSLDate object. Handles
date ranges such as xx-xx or xx/xx and even
xx-xx/yy-yy.year - the year to parse. Should be a four-digit number or a String
whose last four characters are digits.month - the month to parse. May be a number (1-12),
a short month name (Jan to Dec), or a
long month name (January to December). This
method is also able to recognize month names in several locales.CSLDate object or null if both, the year and the
month, could not be parsedpublic static CSLDate toDateRange(String year, String month)
CSLDate object. Handles
date ranges such as xx-xx.year - the year to parse. Should be a four-digit number or a String
whose last four characters are digits.month - the month to parse. May be a number (1-12),
a short month name (Jan to Dec), or a
long month name (January to December). This
method is also able to recognize month names in several locales.CSLDate object or null if both, the year and the
month, could not be parsedpublic static CSLDate toDateSingle(String year, String month)
CSLDate object. Does not
handle ranges.year - the year to parse. Should be a four-digit number or a String
whose last four characters are digits.month - the month to parse. May be a number (1-12),
a short month name (Jan to Dec), or a
long month name (January to December). This
method is also able to recognize month names in several locales.CSLDate object or null if both, the year and the
month, could not be parsedpublic static int toMonth(String month)
month - the month to parse. May be a number (1-12),
a short month name (Jan to Dec), or a
long month name (January to December). This
method is also able to recognize month names in several locales.1-12) or -1 if
the string could not be parsed