When someone performs a query in my application - they get the wrong date showing in the popup; however the correct date is in the .mxd that has the service. When I did a query on the map service - I notice that both my date fields look a bit odd (and there are few other ones too highlighted in red) because its missing the double quotes when you look at the JSON result.
I checked multiple places to see if I had the layer ID's right and made sure everything is pointed to the correct service and they are, so I'm not sure if this is where I'm getting that error. For the example below the correct "Installed" date should be 10/1/1967 but in the query its returning 9/30/1967.
Solved! Go to Solution.
Might have something to do with the time zone... If I enter "-71107200" (seconds, not milliseconds) in the epoch converter: Epoch Converter - Unix Timestamp Converter ... I get this result:
GMT: Sun, 01 Oct 1967 00:00:00 GMT
Your time zone: 30-9-1967 19:00:00 GMT-5:00
Might have something to do with the time zone... If I enter "-71107200" (seconds, not milliseconds) in the epoch converter: Epoch Converter - Unix Timestamp Converter ... I get this result:
GMT: Sun, 01 Oct 1967 00:00:00 GMT
Your time zone: 30-9-1967 19:00:00 GMT-5:00
This is like the biggest 'holy crap - that makes so much sense' moment of the day. How would I go about changing the Time Zone issue? Or is that question for a different group?
Good question... you could post this question in the place corresponding the language of the app you developed. You can find a list of places here:Web Developers
Thanks! This lead us in the correct direction!!
Hi Alice-
I should post this in the Javascript API Place but in the meantime here is a date convert function we put together for EST, where the constant value is the GMT offset for EST in seconds.
convertDate = function (jsDate){ //console.log(jsDate); var myDate = locale.format(new Date(Math.abs(jsDate + 14400000)),{ selector: "date", datePattern: 'MMMM d, yyyy' }); //console.log(Math.abs(jsDate + 14400000)); return myDate; };
You'll need
"dojo/date/locale"
and
"dojo/number"
for JS, not sure what would be used in the other APIs. I strugggled with this one for awhile so I hope this helps!
David
I sure do love coding in JavaScript - but unfortunately this app is in Silverlight (wasn't my choice) but it's another hint on how to get that date to show up in the correct format.
Sure thing. It ought to be pretty similar though. Just have to modify the function properites and constructor options ...