railo.commons.date
Class DateTimeUtil

java.lang.Object
  extended by railo.commons.date.DateTimeUtil
Direct Known Subclasses:
JodaDateTimeUtil, JREDateTimeUtil

public abstract class DateTimeUtil
extends Object


Field Summary
static int DAY
           
static int HOUR
           
static int MILLISECOND
           
static int MINUTE
           
static int MONTH
           
static int QUARTER
           
static int SECOND
           
static int WEEK
           
static int YEAR
           
 
Constructor Summary
DateTimeUtil()
           
 
Method Summary
 int daysInMonth(int year, int month)
          return how much days given month in given year has
abstract  int getDay(TimeZone tz, DateTime dt)
           
abstract  int getDayOfWeek(Locale locale, TimeZone tz, DateTime dt)
           
abstract  int getDayOfYear(Locale locale, TimeZone tz, DateTime dt)
           
abstract  int getDaysInMonth(TimeZone tz, DateTime dt)
           
abstract  long getDiff(TimeZone tz, int datePart, DateTime left, DateTime right)
           
abstract  int getHour(TimeZone tz, DateTime dt)
           
static DateTimeUtil getInstance()
           
abstract  int getMilliSecond(TimeZone tz, DateTime dt)
           
 long getMilliSecondsAdMidnight(TimeZone timeZone, long time)
           
abstract  long getMilliSecondsInDay(TimeZone tz, long time)
           
abstract  int getMinute(TimeZone tz, DateTime dt)
           
abstract  int getMonth(TimeZone tz, DateTime dt)
           
abstract  int getSecond(TimeZone tz, DateTime dt)
           
abstract  int getWeekOfYear(Locale locale, TimeZone tz, DateTime dt)
           
abstract  int getYear(TimeZone tz, DateTime dt)
           
 boolean isLeapYear(int year)
          return if given is is a leap year or not
 boolean toBooleanValue(DateTime dateTime)
          cast boolean value
 DateTime toDateTime(double days)
          returns a date time instance by a number, the conversion from the double to date is o the base of the CFML rules.
 DateTime toDateTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond)
           
 DateTime toDateTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond, DateTime defaultValue)
           
 double toDoubleValue(DateTime dateTime)
           
abstract  String toString(DateTime dt, TimeZone tz)
           
 long toTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond)
           
 long toTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond, long defaultValue)
           
 int toYear(int year)
          translate 2 digit numbers to a year; for example 10 to 2010 or 50 to 1950
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECOND

public static final int SECOND
See Also:
Constant Field Values

MINUTE

public static final int MINUTE
See Also:
Constant Field Values

HOUR

public static final int HOUR
See Also:
Constant Field Values

DAY

public static final int DAY
See Also:
Constant Field Values

YEAR

public static final int YEAR
See Also:
Constant Field Values

MONTH

public static final int MONTH
See Also:
Constant Field Values

WEEK

public static final int WEEK
See Also:
Constant Field Values

QUARTER

public static final int QUARTER
See Also:
Constant Field Values

MILLISECOND

public static final int MILLISECOND
See Also:
Constant Field Values
Constructor Detail

DateTimeUtil

public DateTimeUtil()
Method Detail

getInstance

public static DateTimeUtil getInstance()

toDateTime

public DateTime toDateTime(TimeZone tz,
                           int year,
                           int month,
                           int day,
                           int hour,
                           int minute,
                           int second,
                           int milliSecond)
                    throws DateTimeException
Throws:
DateTimeException

toDateTime

public DateTime toDateTime(TimeZone tz,
                           int year,
                           int month,
                           int day,
                           int hour,
                           int minute,
                           int second,
                           int milliSecond,
                           DateTime defaultValue)

toDateTime

public DateTime toDateTime(double days)
returns a date time instance by a number, the conversion from the double to date is o the base of the CFML rules.

Parameters:
days - double value to convert to a number
Returns:
DateTime Instance

toTime

public long toTime(TimeZone tz,
                   int year,
                   int month,
                   int day,
                   int hour,
                   int minute,
                   int second,
                   int milliSecond,
                   long defaultValue)

toTime

public long toTime(TimeZone tz,
                   int year,
                   int month,
                   int day,
                   int hour,
                   int minute,
                   int second,
                   int milliSecond)
            throws DateTimeException
Throws:
DateTimeException

daysInMonth

public int daysInMonth(int year,
                       int month)
return how much days given month in given year has

Parameters:
year -
month -
Returns:

toYear

public int toYear(int year)
translate 2 digit numbers to a year; for example 10 to 2010 or 50 to 1950

Parameters:
year -
Returns:
year matching number

isLeapYear

public boolean isLeapYear(int year)
return if given is is a leap year or not

Parameters:
year -
Returns:
is leap year

toBooleanValue

public boolean toBooleanValue(DateTime dateTime)
                       throws DateTimeException
cast boolean value

Parameters:
dateTime -
Returns:
boolean value
Throws:
ExpressionException
DateTimeException

toDoubleValue

public double toDoubleValue(DateTime dateTime)

getMilliSecondsAdMidnight

public long getMilliSecondsAdMidnight(TimeZone timeZone,
                                      long time)

getYear

public abstract int getYear(TimeZone tz,
                            DateTime dt)

getMonth

public abstract int getMonth(TimeZone tz,
                             DateTime dt)

getDay

public abstract int getDay(TimeZone tz,
                           DateTime dt)

getHour

public abstract int getHour(TimeZone tz,
                            DateTime dt)

getMinute

public abstract int getMinute(TimeZone tz,
                              DateTime dt)

getSecond

public abstract int getSecond(TimeZone tz,
                              DateTime dt)

getMilliSecond

public abstract int getMilliSecond(TimeZone tz,
                                   DateTime dt)

getMilliSecondsInDay

public abstract long getMilliSecondsInDay(TimeZone tz,
                                          long time)

getDaysInMonth

public abstract int getDaysInMonth(TimeZone tz,
                                   DateTime dt)

getDayOfYear

public abstract int getDayOfYear(Locale locale,
                                 TimeZone tz,
                                 DateTime dt)

getDayOfWeek

public abstract int getDayOfWeek(Locale locale,
                                 TimeZone tz,
                                 DateTime dt)

getWeekOfYear

public abstract int getWeekOfYear(Locale locale,
                                  TimeZone tz,
                                  DateTime dt)

getDiff

public abstract long getDiff(TimeZone tz,
                             int datePart,
                             DateTime left,
                             DateTime right)

toString

public abstract String toString(DateTime dt,
                                TimeZone tz)


Copyright © 2012 Railo