convert to date

Good Morning , I want to convert charechter(2021-04-30T20:30:00.000Z) to date format (%d/%m/%y %H:%M:%OS"), I need a help
Thank you

library(lubridate)

#a character string representing a datetime
(dt_char <- "2021-04-30T20:30:00.000Z")

#a numeric representation of the above datetime suitable for calculations
(dt_1 <- lubridate::parse_date_time(dt_char,"ymd HMS"))

#a recasting of the above numeric datetime to some character string of desired format
(dt_char2 <- format(dt_1,"%d/%m/%y %H:%M:%OS"))
1 Like

Thanks you for help :slightly_smiling_face: :slightly_smiling_face:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.