Packagexp.utils
Classpublic class DateFormat
ImplementsIDataFormatter

Date formatting

See also

support


Public Properties
 PropertyDefined by
  defaultDataFormat : String
[static] The default pattern for database string data Set to "yyyy-MM-ddTHH:mm:ss.Sz" in ApplicationProperties If set here will override the value in ApplicationProperties
DateFormat
  defaultDisplayFormat : String
[static] The default pattern for display one of full long short medium Set to "short" in ApplicationProperties If set here will override the value in ApplicationProperties
DateFormat
  locale : Locale
DateFormat
  pattern : String
DateFormat
  symbols : DateSymbols
DateFormat
  tokens : Array
DateFormat
Public Methods
 MethodDefined by
  
DateFormat(... rest)
Constructs a DateFormat using the given pattern and the default date format symbols for the given locale.
DateFormat
  
applyPattern(pattern:String):void
Applies the given pattern string to this date format Applies the given pattern string to this date format by parsing the pattern into tokens.
DateFormat
  
format(value:*):String
Formats a Date into a date/time string - Formats a Date into a date/time string
DateFormat
  
getDateInstance(style:String = null, locale:Locale = null):DateFormat
[static] Gets the date formatter with the given formatting style for the given locale Gets the date formatter with the given formatting style for the given locale.
DateFormat
  
getDatePattern(pattern:String, locale:Locale = null):String
[static] Returns the pattern for a given locale
DateFormat
  
[static]get a data(sql) DateTime formatter
DateFormat
  
getDateTimeInstance(dateStyle:String = null, timeStyle:String = null, locale:Locale = null):DateFormat
[static] Gets the date/time formatter with the given formatting styles for the given locale Gets the date/time formatter with the given formatting styles for the given locale
DateFormat
  
[static]
DateFormat
  
[static]
DateFormat
  
getEditMask(prompt:String):String
Returns an editor mask string for the current pattern
DateFormat
  
[static] Gets the date formatter with the given formatting style for the given locale.
DateFormat
  
getPatternIndex(pattern:String):int
[static]
DateFormat
  
getSQLDateInstance(locale:Locale = null):DateFormat
[static] Gets the date/time formatter with the DefaultDateDataFormat(ISO8601) formatting style for the given locale Gets the date/time formatter with the DefaultDateDataFormat(ISO8601) formatting styles for the given locale
DateFormat
  
getTimeInstance(style:String = null, locale:Locale = null):DateFormat
[static] Gets the date formatter with the given formatting style for the given locale.
DateFormat
  
getTimePattern(pattern:String, locale:Locale = null):String
[static] Returns the pattern fora given locale
DateFormat
  
isFieldDelimeter(v:String):Boolean
[static] Is the value a field delimeter character
DateFormat
  
parse(value:String):*
Parses text from the beginning of the given string to produce a date - Parses text from the beginning of the given string to produce a date.
DateFormat
Public Constants
 ConstantDefined by
  DEFAULT : String = "default"
[static]
DateFormat
  FULL : String = "full"
[static]
DateFormat
  ISO : String = "iso"
[static]
DateFormat
  LONG : String = "long"
[static]
DateFormat
  MEDIUM : String = "medium"
[static]
DateFormat
  NONE : String = "none"
[static]
DateFormat
  SHORT : String = "short"
[static]
DateFormat
  SQL : String = "sql"
[static]
DateFormat
Property detail
defaultDataFormatproperty
public static var defaultDataFormat:String

The default pattern for database string data Set to "yyyy-MM-ddTHH:mm:ss.Sz" in ApplicationProperties If set here will override the value in ApplicationProperties

defaultDisplayFormatproperty 
public static var defaultDisplayFormat:String

The default pattern for display one of full long short medium Set to "short" in ApplicationProperties If set here will override the value in ApplicationProperties

localeproperty 
public var locale:Locale
patternproperty 
public var pattern:String
symbolsproperty 
public var symbols:DateSymbols
tokensproperty 
public var tokens:Array
Constructor detail
DateFormat()constructor
public function DateFormat(... rest)

Constructs a DateFormat using the given pattern and the default date format symbols for the given locale. Constructs a DateFormat using the given pattern and date format symbols. Takes a variety of signatures DateFormat() Constructs a DateFormat using the default pattern and date format symbols for the default locale. DateFormat(pattern:String) Constructs a DateFormat using the given pattern and the default date format symbols for the default locale. DateFormat(pattern:String, formatSymbols:DateSymbols) Constructs a DateFormat using the given pattern and date format symbols. DateFormat(pattern:String, locale:Locale) Constructs a DateFormat using the given pattern and the default date format symbols for the given locale.

Parameters
... rest
Method detail
applyPattern()method
public function applyPattern(pattern:String):void

Applies the given pattern string to this date format Applies the given pattern string to this date format by parsing the pattern into tokens.

Parameters
pattern:String — - the new date and time pattern for this date format
format()method 
public function format(value:*):String

Formats a Date into a date/time string - Formats a Date into a date/time string

Parameters
value:* — - the time value to be formatted into a time string.

Returns
String — the formatted time string.
getDateInstance()method 
public static function getDateInstance(style:String = null, locale:Locale = null):DateFormat

Gets the date formatter with the given formatting style for the given locale Gets the date formatter with the given formatting style for the given locale.

Parameters
style:String (default = null) — - the given formatting style. For example, SHORT for "M/d/yy" in the US locale.
 
locale:Locale (default = null) — - the given locale,if a locale is not specified uses the default locale

Returns
DateFormat — a date formatter
getDatePattern()method 
public static function getDatePattern(pattern:String, locale:Locale = null):String

Returns the pattern for a given locale

Parameters
pattern:String — one of short,long,medium,full,default or a custom pattern. locale if null defaults to the default locale
 
locale:Locale (default = null)

Returns
String
getDateTimeDataFormatter()method 
public static function getDateTimeDataFormatter(format:String):DateFormat

get a data(sql) DateTime formatter

Parameters
format:String

Returns
DateFormat
getDateTimeInstance()method 
public static function getDateTimeInstance(dateStyle:String = null, timeStyle:String = null, locale:Locale = null):DateFormat

Gets the date/time formatter with the given formatting styles for the given locale Gets the date/time formatter with the given formatting styles for the given locale

Parameters
dateStyle:String (default = null) — - the given date formatting style
 
timeStyle:String (default = null) — - the given time formatting style
 
locale:Locale (default = null) — - the given locale, if a locale is not specified uses the default locale

Returns
DateFormat — a date/time formatter
getDefaultDataPattern()method 
public static function getDefaultDataPattern():String

Returns
String
getDefaultPattern()method 
public static function getDefaultPattern():String

Returns
String
getEditMask()method 
public function getEditMask(prompt:String):String

Returns an editor mask string for the current pattern

Parameters
prompt:String

Returns
String
getInstance()method 
public static function getInstance():DateFormat

Gets the date formatter with the given formatting style for the given locale. Get a default date/time formatter that uses the default style for both the date and the time

Returns
DateFormat — a date formatter
getPatternIndex()method 
public static function getPatternIndex(pattern:String):intParameters
pattern:String

Returns
int
getSQLDateInstance()method 
public static function getSQLDateInstance(locale:Locale = null):DateFormat

Gets the date/time formatter with the DefaultDateDataFormat(ISO8601) formatting style for the given locale Gets the date/time formatter with the DefaultDateDataFormat(ISO8601) formatting styles for the given locale

Parameters
locale:Locale (default = null) — - the given locale, if a locale is not specified uses the default locale

Returns
DateFormat — a date/time formatter
getTimeInstance()method 
public static function getTimeInstance(style:String = null, locale:Locale = null):DateFormat

Gets the date formatter with the given formatting style for the given locale. Gets the date formatter with the given formatting style for the given locale.

Parameters
style:String (default = null) — - the given formatting style. For example, SHORT for "M/d/yy" in the US locale.
 
locale:Locale (default = null) — - the given locale,if a locale is not specified uses the default locale

Returns
DateFormat — a date formatter
getTimePattern()method 
public static function getTimePattern(pattern:String, locale:Locale = null):String

Returns the pattern fora given locale

Parameters
pattern:String — one of short,long,medium,full,default or a custom pattern. locale if null defaults ot the default locale
 
locale:Locale (default = null)

Returns
String
isFieldDelimeter()method 
public static function isFieldDelimeter(v:String):Boolean

Is the value a field delimeter character

Parameters
v:String

Returns
Boolean
parse()method 
public function parse(value:String):*

Parses text from the beginning of the given string to produce a date - Parses text from the beginning of the given string to produce a date. The method may not use the entire text of the given string.

Parameters
value:String — - A String whose beginning should be parsed

Returns
* — A Date parsed from the string
Constant detail
DEFAULTconstant
public static const DEFAULT:String = "default"
FULLconstant 
public static const FULL:String = "full"
ISOconstant 
public static const ISO:String = "iso"
LONGconstant 
public static const LONG:String = "long"
MEDIUMconstant 
public static const MEDIUM:String = "medium"
NONEconstant 
public static const NONE:String = "none"
SHORTconstant 
public static const SHORT:String = "short"
SQLconstant 
public static const SQL:String = "sql"