:: Home >>

AW.Formats.Date

Date formats converter class. Parses the date strings and handles transformations from one date format to another, typically from 'transport' (datasource) formats, like ISO8601 or RFC822, to the display formats, for example 'mmm-dd-yyyy' or similar.

To configure the object specify the format of the date strings in the datasource with the setDataFormat() method and set the output text format with setTextFormat() method.

To activate the date conversion and enable correct date sorting assign the configured date object to the grid column with setCellFormat() call.

Constructor

 var obj = new AW.Formats.Date; 

Hierarchy

Methods

cloneCreates an object clone.
comparatorReturns comparator function.
dataToTextTransforms the external data to the readable text.
dataToValueTransforms the external data to the native value type.
initInitializes the object.
setDataFormatSets the formatting pattern for the external data.
setDataTimezoneSets the timezone for the external data.
setErrorTextSets the error text.
setErrorValueSets the error value.
setTextFormatSets the formatting pattern for the text.
setTextTimezoneSets the timezone for the text.
setTimeoutCalls the function after the specified delay.
textToDataTransforms the text to the external data format.
textToValueTransforms the text to the native value type.
toStringConverts object to string.
valueToDataTransforms the value to the external data format.
valueToTextTransforms the value to the readable text.

Examples

// datasource with dates in iso8601 format
var myData = [
    ["Grid 1.0", "2004-05-18T00:00:00+01:00"],
    ["ActiveWidgets 2.0", "2006-02-08T00:00:00+01:00"]
];

// date converter
var date = new AW.Formats.Date;
date.setDataFormat("ISO8601");
date.setTextFormat("mmm-dd-yyyy");

// grid control
var obj = new AW.UI.Grid;
obj.setCellData(myData);
obj.setCellFormat(date, 1) // dates in the second column
obj.setColumnCount(2);
obj.setRowCount(2);
document.write(obj);

See also

setDataFormat, setTextFormat, setCellFormat methods

Comments

8 Jul 08
Format as date or empty Roland (1)
28 Jan 08
current date Luli (1)
24 Jan 08
setTextTimezone Florin (1)
29 Aug 07
Empty Dates Give #ERR Kevin (1)
16 Aug 07
show me the date -1 day Luli (2)
29 Aug 06
date formatting Patrick (1)
27 Jul 06
Unix Timestamp... any suggestions how to handle it? Yereth (2)
19 Jul 06
Date display Doesn't work. (1)
10 Mar 06
DateTime Formatting Jonathan Doklovic (0)
17 Feb 06
mm-dd-yyyy doesnt work for me? L. Aragon (1)

Comments will appear on this page and in the main forum.

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5