Method Listing
This page will detail all methods available in the DateUtils class
package com.flexoop.utilities.dateutils
CONSTANTS are listed here
public static function dateFormat( date:Date, mask:String=DateUtils.SHORT_DATE_MASK ):String
- Converts a date to a formatted date, based upon the mask parameter.
- Valid masks will take any of the standard Adobe date formatted masks, or one of the masks from the CONSTANTS. Returns date formatted to DateUtils.SHORT_DATE_MASK if mask is in an invalid format.
public static function timeFormat( date:Date, mask:String=DateUtils.SHORT_TIME_MASK ):String
- Converts a date to a formatted time, based upon the mask parameter.
- Valid masks will take any of the standard Adobe time formatted masks, or one of the masks from the CONSTANTS. Returns time formatted to DateUtils.SHORT_TIME_MASK if mask is in an invalid format.
public static function dateTimeFormat( date:Date, mask:String="MM/DD/YYYY L:NN:SS A" ):String
- Converts a date to a formatted date and time, based upon the mask parameter.
- Valid masks will take any of the standard Adobe time formatted masks, or one of the masks from the CONSTANTS. Returns time formatted to DateUtils.SHORT_DATE_MASK DateUtils.SHORT_TIME_MASK if mask is in an invalid format.
public static function dateAdd( datePart:String, number:Number, date:Date ):Date
- Adds or subtracts a specific number of date parts from a date.
- Valid date parts can be found in the CONSTANTS page.
public static function dayOfWeek( date:Date ):Number
- Converts a date to the day of the week that the date represents.
- Valid days of the week in Flex are in the range 0 (Sunday) - 6 (Saturday)
public static function dayOfYear( date:Date ):Number
- Determines the day of the year that a date represents
- Return will be a value between 1 and 365, or 366 on leap years
public static function weekOfYear( date:Date ):Number
- Determines the week of the year that a date represents
- Return will be a value between 1 and 53 (due to the 1 to 2 extra days in a year)
public static function toFlexDayOfWeek( localDayOfWeek:Number ):Number
- Converts a numeric day of the week (1-7) to the Flex range of days of the week (0-6)
public static function dayOfWeekIterationOfMonth( iteration:Number, strDayOfWeek:String, date:Date ):Date
- Gets the Xth day of the month e.g. get the 3rd Wednesday of the month
- Also accepts 'DateUtils.LAST' as a valid iteration value. This will return the last day of week for the month.
- Valid days of the week can be found in the CONSTANTS page.
public static function daysInMonth( date:Date ):Number
- Returns the number of days in the month of the date.
public static function totalDayOfWeekInMonth( strDayOfWeek:String, date:Date ):Number
- Gets the total number of a day of the week in a month
- Valid days of the week can be found in the CONSTANTS page.
public static function toFlexMonth( localMonth:Number ):Number
- Converts a numeric month (1-12) to the Flex range of months (0-11)
public static function isDate( value:String ):Boolean
- Determines whether a value is a valid date
public static function dayOfWeekAsString( date:Date ):String
- Formats a date to the string version of the day of the week
public static function dayOfWeekAsNumber( strDayOfWeek:String ):Number
- Converts a day of the week to its numeric equivalent (0-6)
- Returns -1 if an invalid day of week string is passed in
- Valid days of the week can be found in the CONSTANTS page.
public static function monthAsString( date:Date ):String
- Formats a date to the string version of the month
public static function monthAsNumber( strMonth:String ):Number
- Converts a month to its numeric equivalent (0-11)
- Returns -1 if an invalid month string is passed in
- Valid months can be found in the CONSTANTS page.
public static function daysInYear( date:Date ):Number
- Gets the number of days in a year
public static function isLeapYear( date:Date ):Boolean
- Determines whether the year is a leap year
public static function dateDiff( datePart:String, startDate:Date, endDate:Date ):Number
- Determines the number of date parts difference between 2 dates
- If 'startDate' is before end date, the returned number will be '<' 0 else it will be '>' 0
- Valid date parts can be found in the CONSTANTS page.
Thanks for sharing such a wonder utility.