Select to view content in your preferred language

TIMESTAMP queries down to the second

1298
9
11-19-2018 02:52 PM
WorthSparks
Regular Contributor

In my mobile app (in Swift), I query a feature service in ArcGIS Online. My where clause looks like this:

EditDate > TIMESTAMP '2018-11-17 23:29:34'

My results include records with EditDate equal to the timestamp. I have printed the six returned features' EditDates to the console to make sure I wasn't missing something. They all printed this: "2018-11-17 23:29:34 +0000". Is this a bug in the query routines? Does the EditDate field hold the fraction of the second when the edit actually took place? If so, is there a way for me to access the fractional part in a query?

0 Kudos
9 Replies
WorthSparks
Regular Contributor

I fixed my problem by adding one second to the time and using >=.

EditDate >= TIMESTAMP '2018-11-17 23:29:35'

It seems like this should be more intuitive though.

RyanOlson1
Esri Contributor

The ArcGIS Runtime SDK for iOS supports down to millisecond. It seems that it's possible however the data was stored is where the date was truncated.

WorthSparks
Regular Contributor

In the ArcGIS Online feature service? Maybe this is a limitation of ArcGIS Online?

0 Kudos
RyanOlson1
Esri Contributor

AFAIK the backend services support more precise dates. I'm wondering if it was just however the data was initially collected, the app that the data was initially collected in. I'm not sure how the data was entered, and with what interface. My guess is that is the source of the problem. You might want to ask on the forum associated with that app/interface.

0 Kudos
WorthSparks
Regular Contributor

The data isn't collected. it is only when I query the feature service for EditDate, which is originated by the ArcGIS Online server, that I don't get sub-second accuracy.

0 Kudos
RamaChintapalli
Esri Contributor

As suspected, there seems to be an issue with ArcGIS Online Feature Service, 

During editing, Runtime Client SDK's pass the epoch time (that includes milliseconds) and the Feature Service and the database behind it actually holds the millisecond information for the edit dates. However the parser that was parsing the where clause on the Feature Service is ignoring the millisecond information during queries when TIMESTAMP keyword is provided.

Ex: 

1. This is not working  as milliseconds are being ignored. Runtime clients would need this to work to get millisecond accuracy for queries 

EditDate >= TIMESTAMP '2018-11-17 23:29:35.500'

2. However this works at Feature Service level, where it by-passes the where clause parser and directly queries the database

EditDate >= '2018-11-17 23:29:35.500'
WorthSparks
Regular Contributor

So are you saying currently there is no way to query to the millisecond level if I am using ArcGIS Runtime SDK? What do you mean by works at Feature Service level?

0 Kudos
RyanOlson1
Esri Contributor

Sorry. What application is populating the EditDate field?

0 Kudos
WorthSparks
Regular Contributor

As far as I can tell, that gets populated during my call to AGSServiceFeatureTable.applyEdits(), either locally or on the server.

0 Kudos