I am reading a csv file exported from OData, and encounter a date format that looks like this: /Date(1391514600000)/
.
Any ideas on how to convert this into Date
or POSIX
in R?
This is the Unix epoch time in milliseconds.
x <- "/Date(1391514600000)/"
x <- as.numeric(gsub("[^0-9]", "", x))
x
# [1] 1391514600000
# from milliseconds to seconds:
x <- x / 1000
as.POSIXct(x, origin="1970-01-01", tz="GMT")
# [1] "2014-02-04 11:50:00 GMT"