public final class DateCaster extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
classicStyle |
static short |
CONVERTING_TYPE_NONE |
static short |
CONVERTING_TYPE_OFFSET |
static short |
CONVERTING_TYPE_YEAR |
Constructor and Description |
---|
DateCaster() |
Modifier and Type | Method and Description |
---|---|
static long |
fromShortTime(String str) |
static DateTime |
toDateAdvanced(Object o,
short convertingType,
TimeZone timeZone) |
static DateTime |
toDateAdvanced(Object o,
short convertingType,
TimeZone timeZone,
DateTime defaultValue) |
static DateTime |
toDateAdvanced(Object o,
TimeZone timezone)
converts a Object to a DateTime Object (Advanced but slower)
|
static DateTime |
toDateAdvanced(Object o,
TimeZone timeZone,
DateTime defaultValue)
converts a Object to a DateTime Object (Advanced but slower), returns null if invalid string
|
static DateTime |
toDateAdvanced(String str,
short convertingType,
TimeZone timeZone,
DateTime defaultValue)
converts a String to a DateTime Object (Advanced but slower), returns null if invalid string
|
static DateTime |
toDateAdvanced(String str,
TimeZone timezone)
converts a Object to a DateTime Object (Advanced but slower)
|
static DateTime |
toDateAdvanced(String str,
TimeZone timeZone,
DateTime defaultValue) |
static DateTime |
toDateSimple(boolean b,
TimeZone timeZone)
converts a boolean to a DateTime Object
|
static DateTime |
toDateSimple(char c,
TimeZone timeZone)
converts a char to a DateTime Object
|
static DateTime |
toDateSimple(double d,
TimeZone timeZone)
converts a double to a DateTime Object
|
static DateTime |
toDateSimple(Object o,
short convertingType,
boolean alsoMonthString,
TimeZone timeZone)
converts a Object to a DateTime Object, returns null if invalid string
|
static DateTime |
toDateSimple(Object o,
short convertingType,
boolean alsoMonthString,
TimeZone timeZone,
DateTime defaultValue) |
static DateTime |
toDateSimple(String str,
short convertingType,
boolean alsoMonthString,
TimeZone timeZone)
converts a Object to a DateTime Object, returns null if invalid string
|
static DateTime |
toDateSimple(String str,
short convertingType,
boolean alsoMonthString,
TimeZone timeZone,
DateTime defaultValue)
converts the given string to a date following simple and fast parsing rules (no international formats)
|
static DateTime |
toDateSimple(String str,
TimeZone timeZone)
converts a Object to a DateTime Object, returns null if invalid string
|
static DateTime |
toDateTime(Locale locale,
String str,
TimeZone tz,
boolean useCommomDateParserAsWell)
parse a string to a Datetime Object
|
static DateTime |
toDateTime(Locale locale,
String str,
TimeZone tz,
DateTime defaultValue,
boolean useCommomDateParserAsWell)
parse a string to a Datetime Object, returns null if can't convert
|
static String |
toEuroDate(Object o,
TimeZone timeZone) |
static String |
toShortTime(long time) |
static Time |
toTime(TimeZone timeZone,
Object o)
converts a Object to a Time Object, returns null if invalid string
|
static Time |
toTime(TimeZone timeZone,
String str,
Time defaultValue)
converts a String to a Time Object, returns null if invalid string
|
static String |
toUSDate(Object o,
TimeZone timeZone) |
public static final short CONVERTING_TYPE_NONE
public static final short CONVERTING_TYPE_YEAR
public static final short CONVERTING_TYPE_OFFSET
public static boolean classicStyle
public DateCaster()
public static DateTime toDateAdvanced(Object o, TimeZone timezone) throws PageException
o
- Object to Converttimezone
- PageException
public static DateTime toDateAdvanced(String str, TimeZone timezone) throws PageException
str
- String to Converttimezone
- PageException
public static DateTime toDateAdvanced(Object o, TimeZone timeZone, DateTime defaultValue)
o
- Object to ConverttimeZone
- defaultValue
- public static DateTime toDateAdvanced(String str, short convertingType, TimeZone timeZone, DateTime defaultValue)
str
- String to convertconvertingType
- one of the following values:
- CONVERTING_TYPE_NONE: number are not converted at all
- CONVERTING_TYPE_YEAR: integers are handled as years
- CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTCtimeZone
- defaultValue
- public static DateTime toDateTime(Locale locale, String str, TimeZone tz, boolean useCommomDateParserAsWell) throws PageException
locale
- str
- String representation of a locale Datetz
- PageException
public static DateTime toDateTime(Locale locale, String str, TimeZone tz, DateTime defaultValue, boolean useCommomDateParserAsWell)
locale
- str
- String representation of a locale Datetz
- defaultValue
- public static DateTime toDateAdvanced(String str, TimeZone timeZone, DateTime defaultValue)
public static DateTime toDateSimple(boolean b, TimeZone timeZone)
b
- boolean to ConverttimeZone
- public static DateTime toDateSimple(char c, TimeZone timeZone)
c
- char to ConverttimeZone
- public static DateTime toDateSimple(double d, TimeZone timeZone)
d
- double to ConverttimeZone
- public static DateTime toDateSimple(Object o, short convertingType, boolean alsoMonthString, TimeZone timeZone) throws PageException
o
- Object to ConvertconvertingType
- one of the following values:
- CONVERTING_TYPE_NONE: number are not converted at all
- CONVERTING_TYPE_YEAR: integers are handled as years
- CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTCtimeZone
- PageException
public static DateTime toDateSimple(Object o, short convertingType, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue)
o
- convertingType
- one of the following values:
- CONVERTING_TYPE_NONE: number are not converted at all
- CONVERTING_TYPE_YEAR: integers are handled as years
- CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTCalsoMonthString
- timeZone
- defaultValue
- public static DateTime toDateSimple(String str, TimeZone timeZone) throws PageException
str
- String to ConverttimeZone
- PageException
public static Time toTime(TimeZone timeZone, Object o) throws PageException
o
- Object to ConvertPageException
public static DateTime toDateAdvanced(Object o, short convertingType, TimeZone timeZone, DateTime defaultValue)
o
- convertingType
- one of the following values:
- CONVERTING_TYPE_NONE: number are not converted at all
- CONVERTING_TYPE_YEAR: integers are handled as years
- CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTCtimeZone
- defaultValue
- public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone) throws PageException
str
- Stringt to ConvertconvertingType
- one of the following values:
- CONVERTING_TYPE_NONE: number are not converted at all
- CONVERTING_TYPE_YEAR: integers are handled as years
- CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTCtimeZone
- PageException
public static DateTime toDateAdvanced(Object o, short convertingType, TimeZone timeZone) throws PageException
PageException
public static Time toTime(TimeZone timeZone, String str, Time defaultValue)
str
- String to convertdefaultValue
-
public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue)
str
- convertingType
- one of the following values:
- CONVERTING_TYPE_NONE: number are not converted at all
- CONVERTING_TYPE_YEAR: integers are handled as years
- CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTCalsoMonthString
- allow that the month is defined as english word (jan,janauary ...)timeZone
- defaultValue
- public static String toUSDate(Object o, TimeZone timeZone) throws PageException
PageException
public static String toEuroDate(Object o, TimeZone timeZone) throws PageException
PageException
public static String toShortTime(long time)
public static long fromShortTime(String str)
Copyright © 2015 Lucee