Package | sekati.utils |
Class | public class DateUtil |
Property | Defined by | ||
---|---|---|---|
MONTHS_SHORT : Array [static][read-only]
An array of abbreviated month.
| DateUtil | ||
WEEKDAYS_INITIALS : Array [static][read-only]
An array of initials for the days of the week.
| DateUtil | ||
WEEKDAYS_SHORT : Array [static][read-only]
An array of abbreviated days of the week.
| DateUtil |
Method | Defined by | ||
---|---|---|---|
DateUtil()
DateUtil Static Constructor
| DateUtil | ||
countDays(start:Date, end:Date):Number
[static]
The number of days between the start value and the end value.
| DateUtil | ||
dateCeil(d:Date, timeUnit:String = "day"):Date
[static]
Rounds a date up to the nearest time unit.
| DateUtil | ||
dateDiff(d1:Date, d2:Date = null):Number
[static]
Get the differences between two Dates in milliseconds.
| DateUtil | ||
dateDiffDays(d1:Date, d2:Date):Number
[static]
Get the difference between two Dates in days.
| DateUtil | ||
dateDiffMinutes(d1:Date, d2:Date):Number
[static]
Get the difference between two Dates in minutes.
| DateUtil | ||
dateDiffSeconds(d1:Date, d2:Date):Number
[static]
Get the difference between two Dates in seconds.
| DateUtil | ||
dateFloor(d:Date, timeUnit:String = "day"):Date
[static]
Rounds a date down to the nearest time unit.
| DateUtil | ||
dateFromDB(dbdate:String):Date
[static]
Convert a DB formatted date string into a Flash Date Object.
| DateUtil | ||
getHoursAmPm(hour24:int):Object
[static]
Takes 24hr hours and converts to 12 hour with am/pm.
| DateUtil | ||
getMonthName(index:int):String
[static]
Gets the name of the month specified by index.
| DateUtil | ||
getShortMonthName(index:int):String
[static]
Gets the abbreviated month name specified by index.
| DateUtil | ||
getTotalDaysInMonth(year:int, month:int):int
[static]
Return the number of dates in a specific month.
| DateUtil | ||
getTotalDaysInYear(year:int):int
[static]
Returns the number of days in a specific year.
| DateUtil | ||
isLeapYear(year:int):Boolean
[static]
Determines if the input year is a leap year (with 366 days, rather than 365).
| DateUtil | ||
isSameDay(d0:Date, d1:Date = null):Boolean
[static]
Compare two
Date 's to see if they fall on the same day, month & year. | DateUtil | ||
isValidAge(year:int, month:int, day:int, requiredAge:int):Boolean
[static]
Check if birthdate entered meets required age.
| DateUtil | ||
isValidDate(year:Number, month:Number, day:Number, mustBeInPast:Boolean):Boolean
[static]
Check if a valid date can be created with inputs.
| DateUtil | ||
isValidGregorian(d1:Date):Boolean
[static]
Time values of the Date class prior to the 15th October 1582 pre-date the
introduction of the modern Gregorian Calendar (used by Actionscript, JavaScript, UNIX, etc).
| DateUtil | ||
padTime(n:int):String
[static]
Pads hours, Minutes or Seconds with a leading 0, 12:01 doesn't end up 12:1
| DateUtil | ||
secToFormattedTime(seconds:Number):String
[static]
Convert seconds to a formatted time string.
| DateUtil | ||
toOrdinal(n:int):String
[static]
Reformat an integer to an ordinal number (1st, 2nd, 3rd, 4th, etc).
| DateUtil | ||
toRelative(pastDate:Date):String
Return a human-readable relative string (yesterday, 10 minutes ago, etc) for a Date object.
| DateUtil |
Constant | Defined by | ||
---|---|---|---|
DAYS_IN_APRIL : int = 30 [static]
| DateUtil | ||
DAYS_IN_AUGUST : int = 31 [static]
| DateUtil | ||
DAYS_IN_DECEMBER : int = 31 [static]
| DateUtil | ||
DAYS_IN_FEBRUARY : int = 28 [static]
| DateUtil | ||
DAYS_IN_FEBRUARY_LEAP_YEAR : int = 29 [static]
| DateUtil | ||
DAYS_IN_JANUARY : int = 31 [static]
| DateUtil | ||
DAYS_IN_JULY : int = 31 [static]
| DateUtil | ||
DAYS_IN_JUNE : int = 30 [static]
| DateUtil | ||
DAYS_IN_LEAP_YEAR : int = 366 [static]
| DateUtil | ||
DAYS_IN_MARCH : int = 31 [static]
| DateUtil | ||
DAYS_IN_MAY : int = 31 [static]
| DateUtil | ||
DAYS_IN_MONTHS : Array [static]
| DateUtil | ||
DAYS_IN_NOVEMBER : int = 30 [static]
| DateUtil | ||
DAYS_IN_OCTOBER : int = 31 [static]
| DateUtil | ||
DAYS_IN_SEPTEMBER : int = 30 [static]
| DateUtil | ||
DAYS_IN_YEAR : int = 365 [static]
| DateUtil | ||
MONTHS : Array [static]
| DateUtil | ||
WEEKDAYS : Array [static]
| DateUtil |
MONTHS_SHORT | property |
MONTHS_SHORT:Array
[read-only]
An array of abbreviated month. E.g. Jan, Feb, Mar, Apr, May, Jun, Jul
.
public static function get MONTHS_SHORT():Array
WEEKDAYS_INITIALS | property |
WEEKDAYS_INITIALS:Array
[read-only]
An array of initials for the days of the week. E.g. S, M, T, W, T, F, S
.
public static function get WEEKDAYS_INITIALS():Array
WEEKDAYS_SHORT | property |
WEEKDAYS_SHORT:Array
[read-only]
An array of abbreviated days of the week. E.g. Sun, Mon, Tue, Wed, Thu, Fri, Sat
.
public static function get WEEKDAYS_SHORT():Array
DateUtil | () | constructor |
public function DateUtil()
DateUtil Static Constructor
countDays | () | method |
public static function countDays(start:Date, end:Date):Number
The number of days between the start value and the end value. The result may contain a fractional part, so cast it to int if a whole number is desired.
Parametersstart:Date — the starting date of the range
|
|
end:Date — the ending date of the range
|
Number — the number of days between start and end
|
dateCeil | () | method |
public static function dateCeil(d:Date, timeUnit:String = "day"):Date
Rounds a date up to the nearest time unit.
Parametersd:Date — date to round
|
|
timeUnit:String (default = "day ") — the time unit to round up to
|
Date — the the date object rounded up to
|
dateDiff | () | method |
public static function dateDiff(d1:Date, d2:Date = null):Number
Get the differences between two Dates in milliseconds.
Parametersd1:Date |
|
d2:Date (default = null )
|
Number — difference between two dates in ms
|
dateDiffDays | () | method |
public static function dateDiffDays(d1:Date, d2:Date):Number
Get the difference between two Dates in days.
Parametersd1:Date |
|
d2:Date |
Number — difference between two dates in d
|
dateDiffMinutes | () | method |
public static function dateDiffMinutes(d1:Date, d2:Date):Number
Get the difference between two Dates in minutes.
Parametersd1:Date |
|
d2:Date |
Number — difference between two dates in m
|
dateDiffSeconds | () | method |
public static function dateDiffSeconds(d1:Date, d2:Date):Number
Get the difference between two Dates in seconds.
Parametersd1:Date |
|
d2:Date |
Number — difference between two dates in s
|
dateFloor | () | method |
public static function dateFloor(d:Date, timeUnit:String = "day"):Date
Rounds a date down to the nearest time unit.
Parametersd:Date — date to round
|
|
timeUnit:String (default = "day ") — the time unit to round down to
|
Date — the the date object rounded up to
|
dateFromDB | () | method |
public static function dateFromDB(dbdate:String):Date
Convert a DB formatted date string into a Flash Date Object.
Parametersdbdate:String — date in YYYY-MM-DD HH:MM:SS or YYYY-MM-DD format.
|
Date |
getHoursAmPm | () | method |
public static function getHoursAmPm(hour24:int):Object
Takes 24hr hours and converts to 12 hour with am/pm.
Parametershour24:int |
Object |
getMonthName | () | method |
public static function getMonthName(index:int):String
Gets the name of the month specified by index. This is the month value as stored in a Date object.
Parametersindex:int — the numeric value of the month
|
String — the string name of the month in English
|
getShortMonthName | () | method |
public static function getShortMonthName(index:int):String
Gets the abbreviated month name specified by index. This is the month value as stored in a Date object.
Parametersindex:int — the numeric value of the month
|
String — the short string name of the month in English
|
getTotalDaysInMonth | () | method |
public static function getTotalDaysInMonth(year:int, month:int):int
Return the number of dates in a specific month.
Parametersyear:int |
|
month:int |
int |
getTotalDaysInYear | () | method |
public static function getTotalDaysInYear(year:int):int
Returns the number of days in a specific year.
Parametersyear:int |
int |
isLeapYear | () | method |
public static function isLeapYear(year:int):Boolean
Determines if the input year is a leap year (with 366 days, rather than 365).
Parametersyear:int — the year value as stored in a Date object.
|
Boolean — true if the year input is a leap year
|
isSameDay | () | method |
public static function isSameDay(d0:Date, d1:Date = null):Boolean
Compare two Date
's to see if they fall on the same day, month & year.
d0:Date — first date to compare.
|
|
d1:Date (default = null ) — second date to compare [Optional, Default: today].
|
Boolean — Boolean value denoting whether the date is the same (true ) or not (false ).
|
isValidAge | () | method |
public static function isValidAge(year:int, month:int, day:int, requiredAge:int):Boolean
Check if birthdate entered meets required age.
Parametersyear:int |
|
month:int |
|
day:int |
|
requiredAge:int |
Boolean |
isValidDate | () | method |
public static function isValidDate(year:Number, month:Number, day:Number, mustBeInPast:Boolean):Boolean
Check if a valid date can be created with inputs.
Parametersyear:Number |
|
month:Number |
|
day:Number |
|
mustBeInPast:Boolean |
Boolean |
isValidGregorian | () | method |
public static function isValidGregorian(d1:Date):Boolean
Time values of the Date class prior to the 15th October 1582 pre-date the introduction of the modern Gregorian Calendar (used by Actionscript, JavaScript, UNIX, etc).
Parametersd1:Date |
Boolean |
padTime | () | method |
public static function padTime(n:int):String
Pads hours, Minutes or Seconds with a leading 0, 12:01 doesn't end up 12:1
Parametersn:int |
String |
secToFormattedTime | () | method |
public static function secToFormattedTime(seconds:Number):String
Convert seconds to a formatted time string.
Parametersseconds:Number |
String |
toOrdinal | () | method |
public static function toOrdinal(n:int):String
Reformat an integer to an ordinal number (1st, 2nd, 3rd, 4th, etc).
Parametersn:int |
String |
toRelative | () | method |
public function toRelative(pastDate:Date):String
Return a human-readable relative string (yesterday, 10 minutes ago, etc) for a Date object.
ParameterspastDate:Date — a Date object older that the current Date.
|
String — human readable descriptive string relative to the current date.
|
DAYS_IN_APRIL | constant |
public static const DAYS_IN_APRIL:int = 30
DAYS_IN_AUGUST | constant |
public static const DAYS_IN_AUGUST:int = 31
DAYS_IN_DECEMBER | constant |
public static const DAYS_IN_DECEMBER:int = 31
DAYS_IN_FEBRUARY | constant |
public static const DAYS_IN_FEBRUARY:int = 28
DAYS_IN_FEBRUARY_LEAP_YEAR | constant |
public static const DAYS_IN_FEBRUARY_LEAP_YEAR:int = 29
DAYS_IN_JANUARY | constant |
public static const DAYS_IN_JANUARY:int = 31
DAYS_IN_JULY | constant |
public static const DAYS_IN_JULY:int = 31
DAYS_IN_JUNE | constant |
public static const DAYS_IN_JUNE:int = 30
DAYS_IN_LEAP_YEAR | constant |
public static const DAYS_IN_LEAP_YEAR:int = 366
DAYS_IN_MARCH | constant |
public static const DAYS_IN_MARCH:int = 31
DAYS_IN_MAY | constant |
public static const DAYS_IN_MAY:int = 31
DAYS_IN_MONTHS | constant |
public static const DAYS_IN_MONTHS:Array
DAYS_IN_NOVEMBER | constant |
public static const DAYS_IN_NOVEMBER:int = 30
DAYS_IN_OCTOBER | constant |
public static const DAYS_IN_OCTOBER:int = 31
DAYS_IN_SEPTEMBER | constant |
public static const DAYS_IN_SEPTEMBER:int = 30
DAYS_IN_YEAR | constant |
public static const DAYS_IN_YEAR:int = 365
MONTHS | constant |
public static const MONTHS:Array
WEEKDAYS | constant |
public static const WEEKDAYS:Array