| Method | Defined by | ||
|---|---|---|---|
|
addDays(date1:Date, days:Number):Date
[static]
Adds days to the date date1
| DateTimeUtils | ||
|
ceil(time:Number, resolution:Number):Number
[static]
Limit a date's resolution.
| DateTimeUtils | ||
|
dateCopy(date1:Date):Date
[static]
Clones a date object
| DateTimeUtils | ||
|
dateDiff(date1:Object, date2:Object, unit:int):Number
[static]
Calculate the difference between two dates
Note that difference between simply taking the difference between two date objects and dividing by the unit of time.
| DateTimeUtils | ||
|
dateEqual(date1:Date, date2:Date, unit:int):Boolean
[static]
Compares two dates and return true if they are within the same unit of time
| DateTimeUtils | ||
|
floor(time:Number, resolution:Number):Number
[static]
Limit a date's resolution.
| DateTimeUtils | ||
|
getDate(y:Number, m:Number, d:Number):Date
[static]
Returns a date object for the specified year/month and day, if any value is not set default to now
| DateTimeUtils | ||
|
getDateTimeUnit(interval:int):int
[static]
Given an interval between two dates determine the unit of time
| DateTimeUtils | ||
|
getDayInYear(day:int, month:int, year:int):int
[static]
Calculates the day in a year
| DateTimeUtils | ||
|
getFieldChangeLevel(date1:Object, date2:Object):int
[static]
Detects which field changed between two dates
Example: 2007,2,1` and 2006,2,20 would return YEAR
Example: 2007,1,1,0,0,0,0` and 2006,11,31,23,59,999 would also return YEAR
This would then indicate all fields below that level are invalid
| DateTimeUtils | ||
|
getJan1DayOfWeek(year:int):int
[static]
Get the day of week of Jan 1 of the given year
| DateTimeUtils | ||
|
getNumberOfDaysInMonth(year:Number, month:Number):Number
[static]
Returns the number of days in a month
| DateTimeUtils | ||
|
getQuarterInYear(date:Object):int
[static]
Calculates the number of the quarter in ther year
| DateTimeUtils | ||
|
getStartOfMonth(year:Number, month:Number):Number
[static]
Finds the day of week of the first day of the month
| DateTimeUtils | ||
|
getStartOfMonthAsTime(year:Number, month:Number):Number
[static]
Finds the time(ms from epoch) of the first day of the month
| DateTimeUtils | ||
|
getTimezoneOffset():Number
[static]
Gets the timezone offset from UTC
| DateTimeUtils | ||
|
getWeekNumber(day:int, year:int, firstWeekDays:int):int
[static]
Calculates the week number for a day in a year
| DateTimeUtils | ||
|
isLeapYear(year:int):Boolean
[static]
Calculates if the given year is a leapyear or not
| DateTimeUtils | ||
| Constant | Defined by | ||
|---|---|---|---|
| DAY : int = 4 [static]
| DateTimeUtils | ||
| defaultDayNames : Array [static]
| DateTimeUtils | ||
| defaultMonthNames : Array [static]
| DateTimeUtils | ||
| fields : Array [static]
| DateTimeUtils | ||
| HOUR : int = 3 [static]
| DateTimeUtils | ||
| MILLISECOND : int = 0 [static]
| DateTimeUtils | ||
| MINUTE : int = 2 [static]
| DateTimeUtils | ||
| MONTH : int = 6 [static]
| DateTimeUtils | ||
| ms : Array [static]
| DateTimeUtils | ||
| MSDAY : Number = 8.64E7 [static]
| DateTimeUtils | ||
| MSHOUR : Number = 3600000.0 [static]
| DateTimeUtils | ||
| MSMILLISECOND : Number = 1 [static]
| DateTimeUtils | ||
| MSMINUTE : Number = 60000.0 [static]
| DateTimeUtils | ||
| MSMONTH : Number = 2.4192E9 [static]
| DateTimeUtils | ||
| MSQUARTER : Number = 7.2576E9 [static]
| DateTimeUtils | ||
| MSSECOND : Number = 1000 [static]
| DateTimeUtils | ||
| MSWEEK : Number = 6.048E8 [static]
| DateTimeUtils | ||
| MSYEAR : Number = 3.1536E10 [static]
| DateTimeUtils | ||
| QUARTER : int = 7 [static]
| DateTimeUtils | ||
| SECOND : int = 1 [static]
| DateTimeUtils | ||
| units : Array [static]
| DateTimeUtils | ||
| WEEK : int = 5 [static]
| DateTimeUtils | ||
| YEAR : int = 8 [static]
| DateTimeUtils | ||
| addDays | () | method |
public static function addDays(date1:Date, days:Number):DateAdds days to the date date1
Parametersdate1:Date |
|
days:Number |
Date |
| ceil | () | method |
public static function ceil(time:Number, resolution:Number):Number
Limit a date's resolution. For example, the date 1095767411000
(which represents 2004-09-21 13:50:11) will be changed to
1093989600000 (2004-10-01 00:00:00) when using
MONTH.
time:Number — The time in miliseconds
|
|
resolution:Number — The desired resolution of the date to be returned
|
Number — the date with all values more precise than resolution
set to 0 or 1, expressed as milliseconds since January 1, 1970, 00:00:00 GMT
|
| dateCopy | () | method |
public static function dateCopy(date1:Date):DateClones a date object
Parametersdate1:Date |
Date |
| dateDiff | () | method |
public static function dateDiff(date1:Object, date2:Object, unit:int):NumberCalculate the difference between two dates Note that difference between simply taking the difference between two date objects and dividing by the unit of time. If we compared 10 minutes to midnight and 10 minutes after midnight the simple approach would give the difference as 0 days as the difference is only 20 minutes. The dateDif function however would return 1 day as the two dates are on different days.
Parametersdate1:Object — The starting date
|
|
date2:Object — The ending date
|
|
unit:int — The unit of time to measure.
One of the DateUtils date/time constants QUARTER/WEEK/DAY/HOUR/MINUTE/SECOND
|
Number — The difference in units as specified by interval
|
| dateEqual | () | method |
public static function dateEqual(date1:Date, date2:Date, unit:int):BooleanCompares two dates and return true if they are within the same unit of time
Parametersdate1:Date |
|
date2:Date |
|
unit:int — unit the unit of time to measure defaults to day
|
Boolean — True if the are within the same unit of time
|
| floor | () | method |
public static function floor(time:Number, resolution:Number):Number
Limit a date's resolution. For example, the date 1095767411000
(which represents 2004-09-21 13:50:11) will be changed to
1093989600000 (2004-09-01 00:00:00) when using
MONTH.
time:Number — The time in miliseconds
|
|
resolution:Number — The desired resolution of the date to be returned
|
Number — the date with all values more precise than resolution
set to 0 or 1, expressed as milliseconds since January 1, 1970, 00:00:00 GMT
|
| getDate | () | method |
public static function getDate(y:Number, m:Number, d:Number):DateReturns a date object for the specified year/month and day, if any value is not set default to now
Parametersy:Number |
|
m:Number |
|
d:Number |
Date — The date object as specified
|
| getDateTimeUnit | () | method |
public static function getDateTimeUnit(interval:int):intGiven an interval between two dates determine the unit of time
Parametersinterval:int |
int — the unit of time the interval represents
|
See also
| getDayInYear | () | method |
public static function getDayInYear(day:int, month:int, year:int):intCalculates the day in a year
Parametersday:int — The day in month
|
|
month:int — month
|
|
year:int — full year
|
int — the day in year
|
| getFieldChangeLevel | () | method |
public static function getFieldChangeLevel(date1:Object, date2:Object):intDetects which field changed between two dates Example: 2007,2,1` and 2006,2,20 would return YEAR Example: 2007,1,1,0,0,0,0` and 2006,11,31,23,59,999 would also return YEAR This would then indicate all fields below that level are invalid
Parametersdate1:Object |
|
date2:Object |
int — The top most field that changed
|
| getJan1DayOfWeek | () | method |
public static function getJan1DayOfWeek(year:int):intGet the day of week of Jan 1 of the given year
Parametersyear:int — the full year
|
int |
| getNumberOfDaysInMonth | () | method |
public static function getNumberOfDaysInMonth(year:Number, month:Number):NumberReturns the number of days in a month
Parametersyear:Number |
|
month:Number |
Number — The number of days in the given month
|
| getQuarterInYear | () | method |
public static function getQuarterInYear(date:Object):intCalculates the number of the quarter in ther year
Parametersdate:Object — The time in millisecodns or a Date object
|
int — The quarter
|
| getStartOfMonth | () | method |
public static function getStartOfMonth(year:Number, month:Number):NumberFinds the day of week of the first day of the month
Parametersyear:Number — The target year to check
|
|
month:Number — The target month to check
|
Number — The number of the day of week
|
| getStartOfMonthAsTime | () | method |
public static function getStartOfMonthAsTime(year:Number, month:Number):NumberFinds the time(ms from epoch) of the first day of the month
Parametersyear:Number — The target year to check
|
|
month:Number — The target month to check
|
Number — The time in ms since the epoch
|
| getTimezoneOffset | () | method |
public static function getTimezoneOffset():NumberGets the timezone offset from UTC
ReturnsNumber |
| getWeekNumber | () | method |
public static function getWeekNumber(day:int, year:int, firstWeekDays:int):intCalculates the week number for a day in a year
Parametersday:int — day in year
|
|
year:int — the full year
|
|
firstWeekDays:int — the minimum number of days allowed in the first week
|
int — the week number
|
| isLeapYear | () | method |
public static function isLeapYear(year:int):BooleanCalculates if the given year is a leapyear or not
Parametersyear:int |
Boolean |
| DAY | constant |
public static const DAY:int = 4
| defaultDayNames | constant |
public static const defaultDayNames:Array
| defaultMonthNames | constant |
public static const defaultMonthNames:Array
| fields | constant |
public static const fields:Array
| HOUR | constant |
public static const HOUR:int = 3
| MILLISECOND | constant |
public static const MILLISECOND:int = 0
| MINUTE | constant |
public static const MINUTE:int = 2
| MONTH | constant |
public static const MONTH:int = 6
| ms | constant |
public static const ms:Array
| MSDAY | constant |
public static const MSDAY:Number = 8.64E7
| MSHOUR | constant |
public static const MSHOUR:Number = 3600000.0
| MSMILLISECOND | constant |
public static const MSMILLISECOND:Number = 1
| MSMINUTE | constant |
public static const MSMINUTE:Number = 60000.0
| MSMONTH | constant |
public static const MSMONTH:Number = 2.4192E9
| MSQUARTER | constant |
public static const MSQUARTER:Number = 7.2576E9
| MSSECOND | constant |
public static const MSSECOND:Number = 1000
| MSWEEK | constant |
public static const MSWEEK:Number = 6.048E8
| MSYEAR | constant |
public static const MSYEAR:Number = 3.1536E10
| QUARTER | constant |
public static const QUARTER:int = 7
| SECOND | constant |
public static const SECOND:int = 1
| units | constant |
public static const units:Array
| WEEK | constant |
public static const WEEK:int = 5
| YEAR | constant |
public static const YEAR:int = 8