This one had me scratching my head as well!
I decided to open up the query URL in my browser to see if I was crazy or not.
And the result below indicated that the issue was not my code.
{
"attributes" : {
...
"Date":1596326400000
...
}
}
I eventually started combing the ArcGIS doc pages until I found a mention of how they calculated the date from that number.
I found my answer on the page below:
https://developers.arcgis.com/documentation/common-data-types/feature-object.htm
attributes
—The feature attributes. It is a JSON object that contains a dictionary of name-value pairs. The names are the feature field names. The values are the field values, and they can be any of the standard JSON types: string, number, and boolean. Note that date values are encoded as numbers. The number represents the number of milliseconds since epoch (January 1, 1970) in UTC.
Example:
"attributes" : {
"OWNER" : "Joe Smith", //string
"VALUE" : 94820.37, //number
"APPROVED" : true, //boolean
"LASTUPDATE" : 1227663551096 //date
}
Knowing this, we can easily convert the value from miliseconds to seconds to get UNIX epoch time - then convert that to native r format as decribed in this super helpful stackoverflow question below:
Convert UNIX epoch to Date object
r code:
> myDate <- 1.595394e+12 / 1000
> as.POSIXct(myDate, origin="1970-01-01")
output:
[1] "2020-07-22 01:00:00 EDT"