<?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 do I include a parameter of type 'esriFieldTypeDate ' in a POST request to FeatureService REST method applyEdits()? in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-do-i-include-a-parameter-of-type/m-p/398670#M1940</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe your date/time needs to be in epoch time (Unix time) with milliseconds&amp;nbsp;when using json formatting.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;"LeaseSigned" : 1480615200000‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Nov 2017 17:39:09 GMT</pubDate>
    <dc:creator>RandyBurton</dc:creator>
    <dc:date>2017-11-29T17:39:09Z</dc:date>
    <item>
      <title>How do I include a parameter of type 'esriFieldTypeDate ' in a POST request to FeatureService REST method applyEdits()?</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-do-i-include-a-parameter-of-type/m-p/398669#M1939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm attempting to insert some records into my feature service using the &lt;A href="https://resources.arcgis.com/en/help/rest/apiref/fsedits.html" rel="nofollow noopener noreferrer" target="_blank"&gt;applyEdits()&lt;/A&gt; method, however I'm receiving an error message because I'm not sure how to include data for a field in the feature service table that is of type 'esriFieldTypeDate'.&amp;nbsp; Here is some quick sample code - I have an object that contains my feature to be inserted:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var newFeature = {
&amp;nbsp;&amp;nbsp; "geometry": { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x": -97.2736,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "y": 32.8164
&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp; "attributes": {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "SiteID": 999,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Name": "Test Site 1",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "LeaseSigned": "12/1/2016, 9:00 AM"
&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp; "spatialReference": {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "wkid": "102100"
&amp;nbsp;&amp;nbsp; }
};

var features = [];
features.push(newFeature);&lt;/PRE&gt;&lt;P&gt;I also have an object that&amp;nbsp;contains the input params for applyEdits():&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var params= {
&amp;nbsp;&amp;nbsp; f: 'json',
&amp;nbsp;&amp;nbsp; adds: JSON.stringify(features),
&amp;nbsp;&amp;nbsp; updates: "",
&amp;nbsp;&amp;nbsp; deletes: "",
&amp;nbsp;&amp;nbsp; gdbVersion: "",
&amp;nbsp;&amp;nbsp; rollbackOnFailure: true,
&amp;nbsp;&amp;nbsp; useGlobalIds: false,
&amp;nbsp;&amp;nbsp; attachments: ""
};&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am receiving this error because I'm not sure how to format the input data for&amp;nbsp;&lt;SPAN&gt;esriFieldTypeDate:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN&gt;{
&amp;nbsp;&amp;nbsp; "error":{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "code": 400,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "message":"Unable to complete operation.",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "details":["Setting of value for LeaseSigned failed."]
&amp;nbsp;&amp;nbsp; }
}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Does anybody&amp;nbsp;know how to format the date time field correctly or can point me in the direction of some examples?&amp;nbsp; I've tried all different types of date formats but can't seem to figure this out.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-do-i-include-a-parameter-of-type/m-p/398669#M1939</guid>
      <dc:creator>mfcallahan</dc:creator>
      <dc:date>2021-12-12T16:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I include a parameter of type 'esriFieldTypeDate ' in a POST request to FeatureService REST method applyEdits()?</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-do-i-include-a-parameter-of-type/m-p/398670#M1940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe your date/time needs to be in epoch time (Unix time) with milliseconds&amp;nbsp;when using json formatting.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;"LeaseSigned" : 1480615200000‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 17:39:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-do-i-include-a-parameter-of-type/m-p/398670#M1940</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2017-11-29T17:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I include a parameter of type 'esriFieldTypeDate ' in a POST request to FeatureService REST method applyEdits()?</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-do-i-include-a-parameter-of-type/m-p/398671#M1941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And if using a service like AGOL, you may also need to convert your date/time into UTC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 18:06:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-do-i-include-a-parameter-of-type/m-p/398671#M1941</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2017-11-29T18:06:59Z</dc:date>
    </item>
  </channel>
</rss>

