What format of the datetime value does the REST service (add/update) accept?

9943
2
Jump to solution
08-22-2014 02:01 AM
StephenLam
New Contributor III

I am developing a post back function (.NET 4.5) to the add feature REST service, the database is using SQL server 2012, but I cannot add a feature while it has a datetime attributes (type of the datetime column is datetime2(7), this is generated by ArcCatalog).

.Net code:

String.Format("\"attributes\":{{\"fid\":\"0114081403\",\"start_time\": {0}}}", new JavaScriptSerializer().Serialize(record_date));

The Serialize will return the value like this:  "\/Date(1355496152000)\/"

I have tried something like FORMATDATETIME, but it still not works. Any help would be appreciated!

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Stephen,

I think you should look this article about Supported SQL functions in ArcGIS Server.

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

Richard

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable

Hi Stephen,

I think you should look this article about Supported SQL functions in ArcGIS Server.

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

Richard

0 Kudos
RiyasDeen
Occasional Contributor III

Hi Stephen,

Feature service is returning date in UTC() format. http://services.arcgis.com/V6ZHFr6zdgNZuVG0/ArcGIS/rest/services/U2/FeatureServer/0//query?where=1%3...

Try below:

String.Format("\"attributes\":{{\"fid\":\"0114081403\",\"start_time\": {0}}}", record_date.Subtract(new DateTime(1970,1,1,0,0,0)).Milliseconds )

0 Kudos