3.2.0

TimeStamp with a different Timezone

I am filling the grid with xml data. One column is a timestamp:

<timestamp>2006-08-02 11:39:00.0</timestamp>

My code to format the column:
var timestamp = new AW.Formats.Date;
timestamp.setTextFormat("dd.mm.yyyy hh:mm:ss");
timestamp.setDataFormat("ISO8061");

The grid shows the column with a 2 hour time difference:
02.08.2006 13:39:00

I have tried my best with timestamp.setDataTimezone("UTC"); but did not succeed. Can someone post a working example to deal with a timestamp and how to use the methods
timestamp.setDataTimezone("???"); and
timestamp.setTextTimezone("???");

Thanks for any help...
Kellog
August 3,
timezone methods expect difference between the required timezone and UTC in milliseconds. By default the local timezone is used for text output. If you want to use UTC set timezone to 0 -

timestamp.setTextTimezone(0);

Europe summer time -

timestamp.setTextTimezone(2*3600000);

US EDT -

timestamp.setTextTimezone(-4*3600000);

----

data timezone in most cases is taken from the input string except 'auto' format, where you can use setDataTimezone() to specify another timezone (local timezone by default).

ISO8601 does not require timezone codes as part of input string - in this case it is assumed UTC.
Alex (ActiveWidgets)
August 3,
Thanks for your answer!

timestamp.setTextTimezone(-1);

solved my problem... You just have to use the hour difference as the method's argument.
Kellog
November 9,

This topic is archived.

See also:


Back to support forum