How to convert "2021-05-19T19:30:00.000Z" to datetime?

Viewed 26

I'm using R. The data is coming from a SQL database. Would it be possible to use lubridate? I don't want to have to install any new packages. The data is being imported as a string/char. I have tried the following and both return NAs.

df$Date <- as.POSIXct(df$Date,format="%Y-%m-%dT%H:%M:%SZ")

And

df$Date <- lubridate::ymd_hm(df$Date)
0 Answers
Related