Select to view content in your preferred language

question for identify widget for "useutc"

3412
17
03-07-2013 11:47 AM
ZhujingXia
Frequent Contributor
Robert,

I put my question in this forum, hope can put my screen shot and the config file here to make the question clear.
I used the useutc="treu" in the identfy widget for flex api 2.5, but it still show the UTC time not the local time.

Anything is wrong in file? please advise.
thanks
zhujing
0 Kudos
17 Replies
by Anonymous User
Not applicable
Original User: zhujingx

Robert,

The time shows in arcmap as 3:00 PM, the time shows in browser as 8:00PM(5 hours ahead that UTC). It should be 10:00AM my local time(5 hours late that UTC). See my screen shot.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   And wen you set the useutc="false" what does it show?
0 Kudos
by Anonymous User
Not applicable
Original User: zhujingx

Roblert,

If I set the useutc="false", the result will show the as time as in arcmap (3:00PM)

zhujing
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   And that is what you want right?
0 Kudos
by Anonymous User
Not applicable
Original User: zhujingx

No. i like it to show as 10:00AM of my local time, not 3:00PM (in arcmap).

The issue is that,
1) if i use <field name="C_REPORTEDTIME" dateformat="MM/DD/YYYY LL:NN A" useutc="true"/>,  the time shows as 8:00PM not (10:00Am)

2) if i use <field name="C_REPORTEDTIME" useutc="false"/>, the time shows as 3:00PM not 10:AM neither.

Zhujing
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   The issue is that REST converts any date/time to UTC. So if you have a date that is showing up in ArcMap as 3 pm then a REST query of this data would return it as 10 am. But the big difference is that the Identify task returns the date/time EXACTLY as it is in ArcMap 3 pm and when you set useutc the widget is expecting the datetime to be in UTC and thus ADDs the local UTC time offset to the date/time returned. The useutc attribute is to correct the date/time to LOCAL time NOT make the date/time UTC. You could go in the code and have it subtract the UTC time offset.
0 Kudos
by Anonymous User
Not applicable
Original User: zhujingx

Robert,

I changed code in IdentifyWidget.mxml, under private function msToDate(ms:Number, dateFormat:String, useUTC:Boolean):String

Code used to be:
if (useUTC)
    date.minutes += date.timezoneOffset;
I changed to
    date.minutes += -300;

there is something not right for date.timezoneOffset, I use fixed number there instead of variable. In the cofig file, i still keep use the code like this:
  <field name="C_REPORTEDTIME" dateformat="MM/DD/YYYY LL:NN A" useutc="true"/>


Thanks
Zhujing
0 Kudos
MarceloRS
New Contributor
Robert, thanks for the information about the REST queries and date/time, it was helpful for me.


Marcelo.
0 Kudos