<?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 Re: How can I insert local time in database from Survey123 form? in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857133#M25005</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;Kristin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a couple of methods that might help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While date/time fields in a feature service are stored in UTC, Survey123 (and other&amp;nbsp;ArcGIS applications) will display the date/time in your local time zone. You can save this value (in local time zone) to a &lt;EM&gt;string&lt;/EM&gt; using the &lt;STRONG&gt;format-date()&lt;/STRONG&gt; function. For example, using a calculation similar to this in a text question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;format-date(${datetime1},'%d/%m/%Y %H:%M')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need the 'local' date/time to stay in date/time format, you could use something similar to your calculation above but with a slight correction. The&amp;nbsp;pulldata("@property", 'utcoffset') expression returns the UTC offset in hours for your location. Multiply this offset by 1000 * 60 * 60 to get milliseconds (for Epoch time). So your calculation would look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;${datetime1} + (pulldata("@property", 'utcoffset') * 1000 * 60 * 60)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that Epoch (UNIX) time calculations work well in the Survey123 field app but not in the web app; if you're using your survey in both the field app and the web app it'd be better to use decimal time for your calculations. There are a set of formulas for converting to decimal time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this blog for more detail and useful&amp;nbsp;examples:&amp;nbsp;&lt;A href="https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis"&gt;https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this help topic on dates and times in Survey123:&amp;nbsp;&lt;A class="link-titled" href="https://doc.arcgis.com/en/survey123/browser/create-surveys/decimaldatetime.htm" title="https://doc.arcgis.com/en/survey123/browser/create-surveys/decimaldatetime.htm"&gt;Decimal date time—Survey123 for ArcGIS | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Feb 2020 02:41:54 GMT</pubDate>
    <dc:creator>Jim-Moore</dc:creator>
    <dc:date>2020-02-24T02:41:54Z</dc:date>
    <item>
      <title>How can I insert local time in database from Survey123 form?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857132#M25004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a survey that asks for the dat and time a sample was collected and incubated. This survey is linked to a Feature Service in my ArcGIS server environment which references data in my company's locally hosted database, SQL Server.&lt;/P&gt;&lt;P&gt;Whilst creating a report for the data entered from the survey I discovered that the timestamp is set in UTC time, which is a 6 hour difference from my time.&lt;/P&gt;&lt;P&gt;I set this calculated field in the 123 Connect form, however this doesn't seem to work as nothing is inserted into that column in the database when submitting a survey:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/482952_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;How can I overcome this? My time zone is UTC -6&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2020 23:24:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857132#M25004</guid>
      <dc:creator>KristinVernon</dc:creator>
      <dc:date>2020-02-21T23:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I insert local time in database from Survey123 form?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857133#M25005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;Kristin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a couple of methods that might help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While date/time fields in a feature service are stored in UTC, Survey123 (and other&amp;nbsp;ArcGIS applications) will display the date/time in your local time zone. You can save this value (in local time zone) to a &lt;EM&gt;string&lt;/EM&gt; using the &lt;STRONG&gt;format-date()&lt;/STRONG&gt; function. For example, using a calculation similar to this in a text question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;format-date(${datetime1},'%d/%m/%Y %H:%M')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need the 'local' date/time to stay in date/time format, you could use something similar to your calculation above but with a slight correction. The&amp;nbsp;pulldata("@property", 'utcoffset') expression returns the UTC offset in hours for your location. Multiply this offset by 1000 * 60 * 60 to get milliseconds (for Epoch time). So your calculation would look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;${datetime1} + (pulldata("@property", 'utcoffset') * 1000 * 60 * 60)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that Epoch (UNIX) time calculations work well in the Survey123 field app but not in the web app; if you're using your survey in both the field app and the web app it'd be better to use decimal time for your calculations. There are a set of formulas for converting to decimal time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this blog for more detail and useful&amp;nbsp;examples:&amp;nbsp;&lt;A href="https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis"&gt;https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this help topic on dates and times in Survey123:&amp;nbsp;&lt;A class="link-titled" href="https://doc.arcgis.com/en/survey123/browser/create-surveys/decimaldatetime.htm" title="https://doc.arcgis.com/en/survey123/browser/create-surveys/decimaldatetime.htm"&gt;Decimal date time—Survey123 for ArcGIS | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2020 02:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857133#M25005</guid>
      <dc:creator>Jim-Moore</dc:creator>
      <dc:date>2020-02-24T02:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I insert local time in database from Survey123 form?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857134#M25006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello thanks for the response. I updated the calculation but my problem is that when submitting a form the datetime value is not calculated and inserted in that field. Is there something else I should add?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2020 21:07:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857134#M25006</guid>
      <dc:creator>KristinVernon</dc:creator>
      <dc:date>2020-02-24T21:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I insert local time in database from Survey123 form?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857135#M25007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kristin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be possible to provide your XLSForm so I can take a closer look? You can attach files to a GeoNet reply using the advanced editor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2020 23:50:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/how-can-i-insert-local-time-in-database-from/m-p/857135#M25007</guid>
      <dc:creator>Jim-Moore</dc:creator>
      <dc:date>2020-02-24T23:50:53Z</dc:date>
    </item>
  </channel>
</rss>

