Time in offline replica

736
7
04-14-2020 02:00 PM
JoeHershman
MVP Regular Contributor

I see in the offline replica time is stored as a double.  But I cannot figure out how this number is determined.  I would have assumed it was unix time, but it is not.

Follow-up to that is how could one query a replica using a date.  I want something like:

date component of datefield is April 14 2020. 

Right now the only thing I can see if to return all the rows and filter, obviously not the approach I would like to take.

Thanks

-Joe

0 Kudos
7 Replies
dotMorten_esri
Esri Frequent Contributor

Which API are you seeing that we return a double instead of a date/time?

0 Kudos
JoeHershman
MVP Regular Contributor

I'm just looking at the database to see how it is stored.  My goal is to make a query like I described.  So my real question is about doing that.   In trying to set that up I looked at the database to see that it is stored within the replica as a double.  Thinking if I could figure out how that is derived I may be able to do the query I would like.  Right now I am stuck with returning all the records and then checking dates.

0 Kudos
dotMorten_esri
Esri Frequent Contributor

The database schema is afaik not documented, and subject to change at any time.

Are we missing an API you need, so you don't have to do that? If so, could you describe the scenario/user-story so we can add something to our backlog.

0 Kudos
dotMorten_esri
Esri Frequent Contributor

...btw an informed guess is that it's likely a unix epoch of sorts.

0 Kudos
JoeHershman
MVP Regular Contributor

What I want to do is run a query on the created date field.  In our specific case we want to know if any records with a specific attribute have been created that day.  Something like...

"Where CONTRACTOR = '{name}' AND CREATED_DATE = '04/14/2020'"  I believe in a feature service I could do something like:

"Where CONTRACTOR = '{name}' and CREATED_DATE = DATE '04/14/2020'" 

According to:

Querying Feature Services: Date-Time Queries 

But don't seem to be able to get something like this working with a replica (and I have not tested this against a feature service to know if it would really work)

Thanks

-Joe

0 Kudos
DwayneKuykendall
New Contributor II

 

The date is in "Julian" format.  Basically, the whole number portion is the day and the decimal portion is the time.

https://www.onlineconversion.com/julian_date.htm

 

c# conversion hints at this site:

https://stackoverflow.com/questions/5248827/convert-datetime-to-julian-date-in-c-sharp-tooadate-safe

MortenNielsen, this data is frequently used outside of the ESRI platform as the SDK is severely lacking in so many features.  One most painfully obvious is the ability to work with relational data, something that just eludes the ESRI programmers ability. 

Reporting and dashboards is another use of the raw data.  Not necessary for functionality to be built into the SDK, but the ability is there with 3rd party tools.

0 Kudos
JoeHershman
MVP Regular Contributor

A year in a half later, still have never figured out a way to query a date field using Runtime API

0 Kudos