railo.runtime.op.date
Class DateCaster

java.lang.Object
  extended by railo.runtime.op.date.DateCaster

public final class DateCaster
extends Object

Class to cast Strings to Date Objects


Field Summary
static boolean classicStyle
           
 
Constructor Summary
DateCaster()
           
 
Method Summary
static long fromShortTime(String str)
           
static DateTime toDateAdvanced(Object o, boolean alsoNumbers, TimeZone timeZone)
           
static DateTime toDateAdvanced(Object o, boolean alsoNumbers, 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, boolean alsoNumbers, 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, boolean alsoNumbers, boolean alsoMonthString, TimeZone timeZone)
          converts a Object to a DateTime Object, returns null if invalid string
static DateTime toDateSimple(Object o, boolean alsoNumbers, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue)
           
static DateTime toDateSimple(String str, boolean alsoNumbers, boolean alsoMonthString, TimeZone timeZone)
          converts a Object to a DateTime Object, returns null if invalid string
static DateTime toDateSimple(String str, boolean alsoNumbers, 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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classicStyle

public static boolean classicStyle
Constructor Detail

DateCaster

public DateCaster()
Method Detail

toDateAdvanced

public static DateTime toDateAdvanced(Object o,
                                      TimeZone timezone)
                               throws PageException
converts a Object to a DateTime Object (Advanced but slower)

Parameters:
o - Object to Convert
timezone -
Returns:
Date Time Object
Throws:
PageException

toDateAdvanced

public static DateTime toDateAdvanced(String str,
                                      TimeZone timezone)
                               throws PageException
converts a Object to a DateTime Object (Advanced but slower)

Parameters:
str - String to Convert
timezone -
Returns:
Date Time Object
Throws:
PageException

toDateAdvanced

public static DateTime toDateAdvanced(Object o,
                                      TimeZone timeZone,
                                      DateTime defaultValue)
converts a Object to a DateTime Object (Advanced but slower), returns null if invalid string

Parameters:
o - Object to Convert
timeZone -
defaultValue -
Returns:
Date Time Object

toDateAdvanced

public static DateTime toDateAdvanced(String str,
                                      boolean alsoNumbers,
                                      TimeZone timeZone,
                                      DateTime defaultValue)
converts a String to a DateTime Object (Advanced but slower), returns null if invalid string

Parameters:
str - String to convert
timeZone -
defaultValue -
Returns:
Date Time Object

toDateTime

public static DateTime toDateTime(Locale locale,
                                  String str,
                                  TimeZone tz,
                                  boolean useCommomDateParserAsWell)
                           throws PageException
parse a string to a Datetime Object

Parameters:
locale -
str - String representation of a locale Date
tz -
Returns:
DateTime Object
Throws:
PageException

toDateTime

public 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

Parameters:
locale -
str - String representation of a locale Date
tz -
defaultValue -
Returns:
datetime object

toDateAdvanced

public static DateTime toDateAdvanced(String str,
                                      TimeZone timeZone,
                                      DateTime defaultValue)

toDateSimple

public static DateTime toDateSimple(boolean b,
                                    TimeZone timeZone)
converts a boolean to a DateTime Object

Parameters:
b - boolean to Convert
timeZone -
Returns:
coverted Date Time Object

toDateSimple

public static DateTime toDateSimple(char c,
                                    TimeZone timeZone)
converts a char to a DateTime Object

Parameters:
c - char to Convert
timeZone -
Returns:
coverted Date Time Object

toDateSimple

public static DateTime toDateSimple(double d,
                                    TimeZone timeZone)
converts a double to a DateTime Object

Parameters:
d - double to Convert
timeZone -
Returns:
coverted Date Time Object

toDateSimple

public static DateTime toDateSimple(Object o,
                                    boolean alsoNumbers,
                                    boolean alsoMonthString,
                                    TimeZone timeZone)
                             throws PageException
converts a Object to a DateTime Object, returns null if invalid string

Parameters:
o - Object to Convert
timeZone -
Returns:
coverted Date Time Object
Throws:
PageException

toDateSimple

public static DateTime toDateSimple(Object o,
                                    boolean alsoNumbers,
                                    boolean alsoMonthString,
                                    TimeZone timeZone,
                                    DateTime defaultValue)

toDateSimple

public static DateTime toDateSimple(String str,
                                    TimeZone timeZone)
                             throws PageException
converts a Object to a DateTime Object, returns null if invalid string

Parameters:
str - String to Convert
timeZone -
Returns:
coverted Date Time Object
Throws:
PageException

toTime

public static Time toTime(TimeZone timeZone,
                          Object o)
                   throws PageException
converts a Object to a Time Object, returns null if invalid string

Parameters:
o - Object to Convert
Returns:
coverted Date Time Object
Throws:
PageException

toDateAdvanced

public static DateTime toDateAdvanced(Object o,
                                      boolean alsoNumbers,
                                      TimeZone timeZone,
                                      DateTime defaultValue)

toDateSimple

public static DateTime toDateSimple(String str,
                                    boolean alsoNumbers,
                                    boolean alsoMonthString,
                                    TimeZone timeZone)
                             throws PageException
converts a Object to a DateTime Object, returns null if invalid string

Parameters:
str - Stringt to Convert
alsoNumbers -
timeZone -
Returns:
coverted Date Time Object
Throws:
PageException

toDateAdvanced

public static DateTime toDateAdvanced(Object o,
                                      boolean alsoNumbers,
                                      TimeZone timeZone)
                               throws PageException
Throws:
PageException

toTime

public static Time toTime(TimeZone timeZone,
                          String str,
                          Time defaultValue)
converts a String to a Time Object, returns null if invalid string

Parameters:
str - String to convert
defaultValue -
Returns:
Time Object
Throws:

toDateSimple

public static DateTime toDateSimple(String str,
                                    boolean alsoNumbers,
                                    boolean alsoMonthString,
                                    TimeZone timeZone,
                                    DateTime defaultValue)
converts the given string to a date following simple and fast parsing rules (no international formats)

Parameters:
str -
alsoNumbers -
alsoMonthString - allow that the month is defined as english word (jan,janauary ...)
timeZone -
defaultValue -
Returns:

toUSDate

public static String toUSDate(Object o,
                              TimeZone timeZone)
                       throws PageException
Throws:
PageException

toEuroDate

public static String toEuroDate(Object o,
                                TimeZone timeZone)
                         throws PageException
Throws:
PageException

toShortTime

public static String toShortTime(long time)

fromShortTime

public static long fromShortTime(String str)


Copyright © 2012 Railo