Select to view content in your preferred language

Regarding "Time"  field in ArcGIS JSAPI 3.4/3.5

1730
5
Jump to solution
12-02-2013 07:33 PM
SunilPalkar
Deactivated User
Hello All,

I am using time aware data in my ArcGIS JSAPI application. It works fine with the time-slider.

However I have question regarding displaying "time"  field in REST ,after querying in REST all time related entries are getting long integers (attached in screenshot) but those entries are perfect in ArcMap ( in mm/dd/yyyy format)

So any one know the reason behind that ?

Thanks in advance !!

Screenshots : [ATTACH=CONFIG]29514[/ATTACH][ATTACH=CONFIG]29515[/ATTACH]
0 Kudos
1 Solution

Accepted Solutions
ManishkumarPatel
Deactivated User
Hello All,

I am using time aware data in my ArcGIS JSAPI application. It works fine with the time-slider.

However I have question regarding displaying "time"  field in REST ,after querying in REST all time related entries are getting long integers (attached in screenshot) but those entries are perfect in ArcMap ( in mm/dd/yyyy format)

So any one know the reason behind that ?

Thanks in advance !!

Screenshots : [ATTACH=CONFIG]29514[/ATTACH][ATTACH=CONFIG]29515[/ATTACH]



Hi Sunil,

The date value you mentioned is epoch time,which is defined as the number of seconds since midnight (UTC) on 1st January 1970.

What is epoch time?
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but 'epoch' is often used as a synonym for 'Unix time'. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038). 

Human readable time     Seconds
1 hour    3600 seconds
1 day    86400 seconds
1 week    604800 seconds
1 month (30.44 days)     2629743 seconds
1 year (365.24 days)      31556926 seconds


Although when you are retrieving the value and want to display in your application you will have to convert it using the below:

var someDate = new Date(dateString);

Hope this helps.

Best Regards,
Manish Patel

View solution in original post

0 Kudos
5 Replies
ManishkumarPatel
Deactivated User
Hello All,

I am using time aware data in my ArcGIS JSAPI application. It works fine with the time-slider.

However I have question regarding displaying "time"  field in REST ,after querying in REST all time related entries are getting long integers (attached in screenshot) but those entries are perfect in ArcMap ( in mm/dd/yyyy format)

So any one know the reason behind that ?

Thanks in advance !!

Screenshots : [ATTACH=CONFIG]29514[/ATTACH][ATTACH=CONFIG]29515[/ATTACH]



Hi Sunil,

The date value you mentioned is epoch time,which is defined as the number of seconds since midnight (UTC) on 1st January 1970.

What is epoch time?
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but 'epoch' is often used as a synonym for 'Unix time'. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038). 

Human readable time     Seconds
1 hour    3600 seconds
1 day    86400 seconds
1 week    604800 seconds
1 month (30.44 days)     2629743 seconds
1 year (365.24 days)      31556926 seconds


Although when you are retrieving the value and want to display in your application you will have to convert it using the below:

var someDate = new Date(dateString);

Hope this helps.

Best Regards,
Manish Patel
0 Kudos
SunilPalkar
Deactivated User
Thanks a lot Manish : )

You resolved my issue : )
0 Kudos
by Anonymous User
Not applicable
Original User: manish_patel

Thanks a lot Manish : )

You resolved my issue : )


Glad to help 🙂
0 Kudos
SteveCole
Honored Contributor
Be sure to test your date formatting in the browsers or devices you anticipate supporting with your application. For whatever reason, date formatting is not consistent across browsers. I've had a date format that works fine in Firefox but return 'NaN' in IE or Chrome. If you do find that you're having problems, consider using a library such as DateJS.
0 Kudos
SunilPalkar
Deactivated User
Thanks Steve for the link.

Yes I was facing same problem as you mentioned but its resolved after using that js library

thanks once again : )
0 Kudos