public abstract class DateTimeUtil extends Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
DateTimeUtil() |
Modifier and Type | Method and Description |
---|---|
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 int |
getFirstDayOfMonth(TimeZone tz,
DateTime dt) |
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) |
double |
toDoubleValue(long time) |
static String |
toHTTPTimeString(Date date,
boolean oldFormat)
converts a date to a http time String
|
static String |
toHTTPTimeString(long time,
boolean oldFormat) |
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
|
public static final int SECOND
public static final int MINUTE
public static final int HOUR
public static final int DAY
public static final int YEAR
public static final int MONTH
public static final int WEEK
public static final int QUARTER
public static final int MILLISECOND
public DateTimeUtil()
public static DateTimeUtil getInstance()
public DateTime toDateTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond) throws DateTimeException
DateTimeException
public DateTime toDateTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond, DateTime defaultValue)
public DateTime toDateTime(double days)
days
- double value to convert to a numberpublic long toTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond, long defaultValue)
public long toTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliSecond) throws DateTimeException
DateTimeException
public int daysInMonth(int year, int month)
year
- month
- public int toYear(int year)
year
- public boolean isLeapYear(int year)
year
- public boolean toBooleanValue(DateTime dateTime) throws DateTimeException
dateTime
- ExpressionException
DateTimeException
public double toDoubleValue(DateTime dateTime)
public double toDoubleValue(long time)
public long getMilliSecondsAdMidnight(TimeZone timeZone, long time)
public abstract int getMilliSecond(TimeZone tz, DateTime dt)
public abstract long getMilliSecondsInDay(TimeZone tz, long time)
public abstract int getDaysInMonth(TimeZone tz, DateTime dt)
public abstract int getDayOfYear(Locale locale, TimeZone tz, DateTime dt)
public abstract int getDayOfWeek(Locale locale, TimeZone tz, DateTime dt)
public abstract int getWeekOfYear(Locale locale, TimeZone tz, DateTime dt)
public abstract int getFirstDayOfMonth(TimeZone tz, DateTime dt)
public static String toHTTPTimeString(long time, boolean oldFormat)
public static String toHTTPTimeString(Date date, boolean oldFormat)
date
- date to convertoldFormat
- "old" in that context means the format support the existing functionality in CFML like the function getHTTPTimeString, in that format the date parts are separated by a space (like "EE, dd MMM yyyy HH:mm:ss zz"),
in the "new" format, the date part is separated by "-" (like "EE, dd-MMM-yyyy HH:mm:ss zz")Copyright © 2015 Lucee