Package | ardisia.utils |
Class | public class DateUtils |
Inheritance | DateUtils Object |
Completely static class, no need to create any instances.
Method | Defined By | ||
---|---|---|---|
addDays(dt:Date, numberOfDays:Number, returnNewObject:Boolean = true):Date [static]
Add a specified number of days to a Date and return a new Date object. | DateUtils | ||
addMinutes(dt:Date, numberOfMinutes:Number, returnNewObject:Boolean = true):Date [static]
Add a specified number of minutes to a Date object and return a new
Date object. | DateUtils | ||
addMonths(dt:Date, numberOfMonths:Number):Date [static]
Add a specified number of months to a Date object and return a new
Date object. | DateUtils | ||
format(date:Date, format:String):String [static]
Convenience method to return a formatted string using a Flex
DateFormatter. | DateUtils | ||
getClosestDay(dt:Date):Date [static]
Returns the closest day. | DateUtils | ||
getDatePickerStart(dt:Date, firstDayOfWeek:int):Date [static]
Returns the Date object for the start date in the datepicker given the
first day of the week and the month. | DateUtils | ||
getDayOffset(dt:Date, startDate:Date):int [static]
Returns the number of days that separate the Date objects. | DateUtils | ||
getDaysInMonth(examinedDate:Date):int [static]
Returns the number of days in the month. | DateUtils | ||
getFirstDayOfMonth(dt:Date):Date [static]
Returns the Date object for the first day of the month. | DateUtils | ||
getLastMomentOfMonth(examinedDate:Date):Date [static]
Returns the Date object for last moment of the specified month. | DateUtils | ||
getMonthViewConfig(dt:Date, firstDayOfWeek:int, daysPerWeek:int):Object [static]
Returns the startDate and the number of required weeks for a month
view. | DateUtils | ||
getWeekStart(dt:Date, firstDayOfWeek:int):Date [static]
Returns the Date object for the start of a week when provided with a date
within the week and the first day of the week. | DateUtils | ||
scrubTime(dt:Date, returnNewObject:Boolean = true):Date [static]
Removes the time component of a Date object and returns the Date with
only year, month, and day information and hours, minutes, and seconds
are set to 0. | DateUtils |
Constant | Defined By | ||
---|---|---|---|
MILLI_SECONDS_PER_DAY : int = 86400000 [static]
The number of milliseconds in a day. | DateUtils | ||
MILLI_SECONDS_PER_HOUR : int = 3600000 [static]
The number of milliseconds in an hour. | DateUtils | ||
MINUTES_IN_DAY : int = 1440 [static]
The number of minutes in a day. | DateUtils |
addDays | () | method |
public static function addDays(dt:Date, numberOfDays:Number, returnNewObject:Boolean = true):Date
Add a specified number of days to a Date and return a new Date object.
Adjusts for daylight savings.
Parameters
dt:Date — a Date object representing the date to be changed
| |
numberOfDays:Number — the number of days to add. Can be negative
| |
returnNewObject:Boolean (default = true ) — true to return a new Date object, false to return
the original Date object
|
Date — new Date object
|
addMinutes | () | method |
public static function addMinutes(dt:Date, numberOfMinutes:Number, returnNewObject:Boolean = true):Date
Add a specified number of minutes to a Date object and return a new Date object.
Adjusts for daylight savings.
Parameters
dt:Date — a Date object representing the date to be changed
| |
numberOfMinutes:Number — the number of minutes to add. Can be negative
| |
returnNewObject:Boolean (default = true ) — true to return a new Date object, false to return
the original Date object
|
Date — Date object
|
addMonths | () | method |
public static function addMonths(dt:Date, numberOfMonths:Number):Date
Add a specified number of months to a Date object and return a new Date object.
Adjusts for daylight savings.
Parameters
dt:Date — a Date object representing the date to be changed
| |
numberOfMonths:Number — the number of days to add. Can be negative
|
Date — Date object
|
format | () | method |
public static function format(date:Date, format:String):String
Convenience method to return a formatted string using a Flex DateFormatter.
Parameters
date:Date — the Date object to return a formatted string
| |
format:String — the DateFormatter formatString
|
String — String object
|
getClosestDay | () | method |
public static function getClosestDay(dt:Date):Date
Returns the closest day.
Parameters
dt:Date — the month
|
Date — Date object
|
getDatePickerStart | () | method |
public static function getDatePickerStart(dt:Date, firstDayOfWeek:int):Date
Returns the Date object for the start date in the datepicker given the first day of the week and the month.
Parameters
dt:Date — the month for which the start date is returned
| |
firstDayOfWeek:int — an integer that represents the first day of the
week. 0 = Sunday
|
Date — Date object
|
getDayOffset | () | method |
public static function getDayOffset(dt:Date, startDate:Date):int
Returns the number of days that separate the Date objects.
Parameters
dt:Date — the first Date object
| |
startDate:Date — the second Date object
|
int — an integer of the number of days separating the Date objects
|
getDaysInMonth | () | method |
public static function getDaysInMonth(examinedDate:Date):int
Returns the number of days in the month.
Parameters
examinedDate:Date — the month to get the number of days from
|
int — an integer of the number of days in the month
|
getFirstDayOfMonth | () | method |
public static function getFirstDayOfMonth(dt:Date):Date
Returns the Date object for the first day of the month.
Parameters
dt:Date — The month to get the number of days from
|
Date — Date object
|
getLastMomentOfMonth | () | method |
public static function getLastMomentOfMonth(examinedDate:Date):Date
Returns the Date object for last moment of the specified month.
Parameters
examinedDate:Date — the month to have the last moment returned.
|
Date — Date object
|
getMonthViewConfig | () | method |
public static function getMonthViewConfig(dt:Date, firstDayOfWeek:int, daysPerWeek:int):Object
Returns the startDate and the number of required weeks for a month view. Handy since it can be a bit tricky to get these values.
Parameters
dt:Date — the month
| |
firstDayOfWeek:int — an integer that represents the first day of the
week. 0 = Sunday
| |
daysPerWeek:int — an integer that represents the number of days
that will be displayed per week. E.G. if you are displaying a work
week, this param would be 5
|
Object — An object with two properties: startDate Date, and weeks: Number
|
getWeekStart | () | method |
public static function getWeekStart(dt:Date, firstDayOfWeek:int):Date
Returns the Date object for the start of a week when provided with a date within the week and the first day of the week.
Parameters
dt:Date — a Date within the week
| |
firstDayOfWeek:int — an integer that represents the first day of the
week. 0 = Sunday
|
Date — Date object
|
scrubTime | () | method |
public static function scrubTime(dt:Date, returnNewObject:Boolean = true):Date
Removes the time component of a Date object and returns the Date with only year, month, and day information and hours, minutes, and seconds are set to 0.
Parameters
dt:Date — the Date object to be scrubbed
| |
returnNewObject:Boolean (default = true ) — boolean true to create and return a new Date
object
|
Date — Date object
|
MILLI_SECONDS_PER_DAY | Constant |
public static const MILLI_SECONDS_PER_DAY:int = 86400000
The number of milliseconds in a day.
MILLI_SECONDS_PER_HOUR | Constant |
public static const MILLI_SECONDS_PER_HOUR:int = 3600000
The number of milliseconds in an hour.
MINUTES_IN_DAY | Constant |
public static const MINUTES_IN_DAY:int = 1440
The number of minutes in a day.