Packagecom.adobe.utils
Classpublic class DateUtil

Class that contains static utility methods for manipulating and working with Dates.



Public Methods
 MethodDefined by
  
compareDates(d1:Date, d2:Date):int
[static] Compares two dates and returns an integer depending on their relationship.
DateUtil
  
getAMPM(d:Date):String
[static] Returns a string indicating whether the date represents a time in the ante meridiem (AM) or post meridiem (PM).
DateUtil
  
getFullDayIndex(d:String):int
[static] Returns the index of the day that the full day name string represents.
DateUtil
  
getFullDayName(d:Date):String
[static] Returns the English full day name for the day that the Date represents.
DateUtil
  
getFullMonthIndex(m:String):int
[static] Returns the index of the month that the full month name string represents.
DateUtil
  
getFullMonthName(d:Date):String
[static] Returns the English full Month name for the Month that the Date represents.
DateUtil
  
getShortDayIndex(d:String):int
[static] Returns the index of the day that the short day name string represents.
DateUtil
  
getShortDayName(d:Date):String
[static] Returns the English Short Day name (3 letters) for the day that the Date represents.
DateUtil
  
getShortHour(d:Date):int
[static] Returns a short hour (0 - 12) represented by the specified date.
DateUtil
  
getShortMonthIndex(m:String):int
[static] Returns the index of the month that the short month name string represents.
DateUtil
  
getShortMonthName(d:Date):String
[static] Returns the English Short Month name (3 letters) for the Month that the Date represents.
DateUtil
  
getShortYear(d:Date):String
[static] Returns a two digit representation of the year represented by the specified date.
DateUtil
  
getUTCDate(d:Date):Date
[static] Sort of converts a date into UTC.
DateUtil
  
makeMorning(d:Date):Date
[static] Converts a date into just after midnight.
DateUtil
  
makeNight(d:Date):Date
[static] Converts a date into just befor midnight.
DateUtil
  
parseRFC822(str:String):Date
[static] Parses dates that conform to RFC822 into Date objects.
DateUtil
  
parseW3CDTF(str:String):Date
[static] Parses dates that conform to the W3C Date-time Format into Date objects.
DateUtil
  
toRFC822(d:Date):String
[static] Returns a date string formatted according to RFC822.
DateUtil
  
toW3CDTF(d:Date, includeMilliseconds:Boolean = false):String
[static] Returns a date string formatted according to W3CDTF.
DateUtil
Method detail
compareDates()method
public static function compareDates(d1:Date, d2:Date):int

Compares two dates and returns an integer depending on their relationship. Returns -1 if d1 is greater than d2. Returns 1 if d2 is greater than d1. Returns 0 if both dates are equal.

Parameters
d1:Date — The date that will be compared to the second date.
 
d2:Date — The date that will be compared to the first date.

Returns
int — An int indicating how the two dates compare.
getAMPM()method 
public static function getAMPM(d:Date):String

Returns a string indicating whether the date represents a time in the ante meridiem (AM) or post meridiem (PM). If the hour is less than 12 then "AM" will be returned. If the hour is greater than 12 then "PM" will be returned.

Parameters
d:Date — The Date from which to generate the 12 hour clock indicator.

Returns
String — A String ("AM" or "PM") indicating which half of the day the hour represents.
getFullDayIndex()method 
public static function getFullDayIndex(d:String):int

Returns the index of the day that the full day name string represents.

Parameters
d:String — A full day name.

Returns
int — A int that represents that full day represented by the specifed full month name.

See also

FULL_DAY
getFullDayName()method 
public static function getFullDayName(d:Date):String

Returns the English full day name for the day that the Date represents.

Parameters
d:Date — The Date instance whose day will be used to retrieve the full day name.

Returns
String — An English full day name.

See also

FULL_DAY
getFullMonthIndex()method 
public static function getFullMonthIndex(m:String):int

Returns the index of the month that the full month name string represents.

Parameters
m:String — A full month name.

Returns
int — A int that represents that month represented by the specifed full month name.

See also

FULL_MONTH
getFullMonthName()method 
public static function getFullMonthName(d:Date):String

Returns the English full Month name for the Month that the Date represents.

Parameters
d:Date — The Date instance whose month will be used to retrieve the full month name.

Returns
String — An English full month name.

See also

FULL_MONTH
getShortDayIndex()method 
public static function getShortDayIndex(d:String):int

Returns the index of the day that the short day name string represents.

Parameters
d:String — A short day name.

Returns
int — A int that represents that short day represented by the specifed full month name.

See also

SHORT_DAY
getShortDayName()method 
public static function getShortDayName(d:Date):String

Returns the English Short Day name (3 letters) for the day that the Date represents.

Parameters
d:Date — The Date instance whose day will be used to retrieve the short day name.

Returns
String — An English 3 Letter day abbreviation.

See also

SHORT_DAY
getShortHour()method 
public static function getShortHour(d:Date):int

Returns a short hour (0 - 12) represented by the specified date. If the hour is less than 12 (0 - 11 AM) then the hour will be returned. If the hour is greater than 12 (12 - 23 PM) then the hour minus 12 will be returned.

Parameters
d:Date — The Date from which to generate the short hour

Returns
int — An int between 0 and 13 ( 1 - 12 ) representing the short hour.
getShortMonthIndex()method 
public static function getShortMonthIndex(m:String):int

Returns the index of the month that the short month name string represents.

Parameters
m:String — The 3 letter abbreviation representing a short month name.

Returns
int — A int that represents that month represented by the specifed short name.

See also

SHORT_MONTH
getShortMonthName()method 
public static function getShortMonthName(d:Date):String

Returns the English Short Month name (3 letters) for the Month that the Date represents.

Parameters
d:Date — The Date instance whose month will be used to retrieve the short month name.

Returns
String — An English 3 Letter Month abbreviation.

See also

SHORT_MONTH
getShortYear()method 
public static function getShortYear(d:Date):String

Returns a two digit representation of the year represented by the specified date.

Parameters
d:Date — The Date instance whose year will be used to generate a two digit string representation of the year.

Returns
String — A string that contains a 2 digit representation of the year. Single digits will be padded with 0.
getUTCDate()method 
public static function getUTCDate(d:Date):Date

Sort of converts a date into UTC.

Parameters
d:Date

Returns
Date
makeMorning()method 
public static function makeMorning(d:Date):Date

Converts a date into just after midnight.

Parameters
d:Date

Returns
Date
makeNight()method 
public static function makeNight(d:Date):Date

Converts a date into just befor midnight.

Parameters
d:Date

Returns
Date
parseRFC822()method 
public static function parseRFC822(str:String):Date

Parses dates that conform to RFC822 into Date objects. This method also supports four-digit years (not supported in RFC822), but two-digit years (referring to the 20th century) are fine, too. This function is useful for parsing RSS .91, .92, and 2.0 dates.

Parameters
str:String

Returns
Date

See also

parseW3CDTF()method 
public static function parseW3CDTF(str:String):Date

Parses dates that conform to the W3C Date-time Format into Date objects. This function is useful for parsing RSS 1.0 and Atom 1.0 dates.

Parameters
str:String

Returns
Date

See also

toRFC822()method 
public static function toRFC822(d:Date):String

Returns a date string formatted according to RFC822.

Parameters
d:Date

Returns
String

See also

toW3CDTF()method 
public static function toW3CDTF(d:Date, includeMilliseconds:Boolean = false):String

Returns a date string formatted according to W3CDTF.

Parameters
d:Date
 
includeMilliseconds:Boolean (default = false) — Determines whether to include the milliseconds value (if any) in the formatted string.

Returns
String

See also