Select to view content in your preferred language

question for identify widget for "useutc"

3378
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
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   Are you using the compiled widget or the source code. As this is a 2.5 version of the widget I will not be releasing a fix (I only fix current releases) for this if it is a bug bug I can guide you to make any code change that would be needed. I have checked as I said in my earlier comment that the last 2.5.x version of the widget I have on my system, does contain the useutc code.
0 Kudos
by Anonymous User
Not applicable
Original User: zhujingx

Robert,

I am using the source code for identify widget 2.5, I tried to use 3.0 as well, but it did not work neither.
Thank you for your help.
Zhujing
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   Please attach the version of the widget that you are using and tell me the time zone you are using.

Robert
0 Kudos
by Anonymous User
Not applicable
Original User: zhujingx

Robert,

Here is the code. there is UTC time in the database, but I'd like to show in Eastern Time Zone which should 5 hour less than the UTC time.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   OK the issue was that the identify task returns a string date and therefor my code to adjust based on useutc was being skipped.

Here is the changes you need to make. Find the onResult function and then this block of code:
Old Code:
                            if (isDateField && (value != "Null" || value != "")){
                                var dateMS:Number = Number(value);
                                if (!isNaN(dateMS))
                                    value = msToDate(dateMS, dateFormat, useUTC);
                            }

And replace it with this
New Code:
                            if (isDateField && (value != "Null" || value != "")){
                                if (isNaN(Number(value)) == true){
                                    var pDate:Date = new Date(value);
                                    value = msToDate(pDate.getTime(), dateFormat, useUTC);
                                }else{
                                    value = msToDate(Number(value), dateFormat, useUTC);
                                }
                            }
0 Kudos
by Anonymous User
Not applicable
Original User: zhujingx

Robert,
I tried the code, it returned just the date without the time. How could I show the local time?

Following is my code in the cofig file. Is that because I need use other date format instead of "YYYY/MM/DD"?


Thanks

Zhujing

<fields>
   
      <field name="C_FIRSTNAME" alias="FirstName"/>
       <field name="C_REPORTEDTIME" dateformat="YYYY/MM/DD" useutc="true"/>
</fields>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   You just use a dateformat that includes all you want to see.

dateformat="MM/DD/YYYY LL:NN A"
0 Kudos
by Anonymous User
Not applicable
Original User: zhujingx

Robert,

Do you know what is the dataformat for Eatern Time Zone? the follow in dateformate shows 2 hours early than my local time.

dateformat="MM/DD/YYYY LL:NN A"

Thanks
Zhujing
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Zhujing,

   Have you verified the dates in ArcMap? I have tested the use utc code with my date and time sensitive data and it works fine for converting UTC to Central time.
0 Kudos