0

Using R, how do I transform the date and time from here, into a "standard" date/time string format?

2020-12-30T03:32:30.000Z

Yusuf Şengün
  • 284
  • 3
  • 13
Grace
  • 201
  • 2
  • 13

2 Answers2

1

Use ?strptime

strptime("2020-12-30T03:32:30.000Z", "%Y-%m-%dT%H:%M:%S")
# [1] "2020-12-30 03:32:30 CET"
Ben
  • 784
  • 5
  • 14
1

You can also use:

#Code
as.POSIXct(gsub('T|Z',' ','2020-12-30T03:32:30.000Z'),'%Y-%m-%d %H:%M:%S.%OS')

Output:

[1] "2020-12-30 03:32:30 GMT"
Duck
  • 39,058
  • 13
  • 42
  • 84