<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic problems retrieving correct datetime value from SDE/SQL Server in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-retrieving-correct-datetime-value-from/m-p/92617#M8425</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using the ArcGIS Server JS API to store a new feature using ApplyEdits.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The feature is created sucessfully. One of the feature attributes is a datetime field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The field value is defined like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dt = new Date(2014, 6, 24, 10, 32);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fieldvalue = dt.valueOf();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The time of 10:32 goes into the database as 1402997520000 (the primitive value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the SQL Server database the time reads 10:32&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I retrieve the datetime value using the JS API the primitive value is 1402997519999, which displays as : 10:31.5999&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where am I going wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jun 2014 10:01:46 GMT</pubDate>
    <dc:creator>JustinClowes</dc:creator>
    <dc:date>2014-06-24T10:01:46Z</dc:date>
    <item>
      <title>problems retrieving correct datetime value from SDE/SQL Server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-retrieving-correct-datetime-value-from/m-p/92617#M8425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using the ArcGIS Server JS API to store a new feature using ApplyEdits.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The feature is created sucessfully. One of the feature attributes is a datetime field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The field value is defined like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dt = new Date(2014, 6, 24, 10, 32);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fieldvalue = dt.valueOf();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The time of 10:32 goes into the database as 1402997520000 (the primitive value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the SQL Server database the time reads 10:32&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I retrieve the datetime value using the JS API the primitive value is 1402997519999, which displays as : 10:31.5999&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where am I going wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 10:01:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-retrieving-correct-datetime-value-from/m-p/92617#M8425</guid>
      <dc:creator>JustinClowes</dc:creator>
      <dc:date>2014-06-24T10:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: problems retrieving correct datetime value from SDE/SQL Server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-retrieving-correct-datetime-value-from/m-p/92618#M8426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What is the fieldtype in the database? Date, Number... also what type of database MsSQL, Oracle, MySQL... I am assuming it is MSSQL Server but don't want to assume.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would have to format the date before you insert it into the database. Other than 3 extra zeros at the end, that value looks like a unix timestamp.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know the field type and can advise further.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ray&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 19:35:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-retrieving-correct-datetime-value-from/m-p/92618#M8426</guid>
      <dc:creator>RaymondGoins</dc:creator>
      <dc:date>2014-06-24T19:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: problems retrieving correct datetime value from SDE/SQL Server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-retrieving-correct-datetime-value-from/m-p/92619#M8427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Justin,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The date value you mentioned is epoch time,which is defined as the number of seconds since midnight (UTC) on 1st January 1970.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is epoch time?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the&amp;nbsp; number of seconds that have elapsed since January 1, 1970 (midnight&amp;nbsp; UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).&amp;nbsp; Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but&amp;nbsp; 'epoch' is often used as a synonym for 'Unix time'. Many Unix systems&amp;nbsp; store epoch dates as a signed 32-bit integer, which might cause problems&amp;nbsp; on January 19, 2038 (known as the Year 2038 problem or Y2038).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Human readable time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Seconds&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 hour&amp;nbsp;&amp;nbsp;&amp;nbsp; 3600 seconds&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 day&amp;nbsp;&amp;nbsp;&amp;nbsp; 86400 seconds&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 week&amp;nbsp;&amp;nbsp;&amp;nbsp; 604800 seconds&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 month (30.44 days)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2629743 seconds&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 year (365.24 days)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31556926 seconds&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although when you are retrieving the value and want to display in your application you will have to convert it using the below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var someDate = new Date(dateString);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://jsfiddle.net/patelmanya/Yz8Lv/"&gt;http://jsfiddle.net/patelmanya/Yz8Lv/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Manish Patel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 00:22:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-retrieving-correct-datetime-value-from/m-p/92619#M8427</guid>
      <dc:creator>ManishkumarPatel</dc:creator>
      <dc:date>2014-06-25T00:22:48Z</dc:date>
    </item>
  </channel>
</rss>

