how do I convert a as.Date of R to a Date in ArcGIS? The field is a date in the r data.frame, but when it is opened in arcgis, it is a character/ string type.
Hi Srirama Bhamidipati,
You may want to use Python to convert the string in ArcGIS to a datetime object.
Does this Stack Overflow discussion python - Converting string into datetime - Stack Overflow answer your question?
datetime.strptimeis the main routine for parsing strings into datetimes. It can handle all sorts of formats, with the format determined by a format string you give it
Can you provide a code sample? I'm not able to reproduce this, as.Date and POSIX date objects are being converted to a Date field in an output geodatabase in my tests. Here's an example:
library(arcgisbinding) arc.check_product() Sys.setenv(TZ="UTC") df <- data.frame( a = c(0, 1, NA, -Inf, Inf), b = c("a", "b", NA, "c", ""), c = c(as.Date("2001-01-01"), NA, -99, 0, 1), d = c(as.POSIXct("2001-01-01"), NA, -99, 0, 1), arc.write("date.gdb/with_date")
With that, I get two date columns, "c" and "d", which contain values I would expect.