We can use strptime
to convert to a datetime class and then format
to extract the hour:min:sec.
dtime <- strptime(str1, "%Y-%m-%dT%H:%M:%SZ")
format(dtime, "%H:%M:%S")
#[1] "17:07:36"
If the OP wants to have the hour, min, sec as separate columns
read.table(text=format(dtime, "%H:%M:%S"), sep=":", header=FALSE)
# V1 V2 V3
#1 17 7 36
Another option is using lubridate
library(lubridate)
format(ymd_hms(str1), "%H:%M:%S")
#[1] "17:07:36"
data
str1 <- "2008-08-07T17:07:36Z"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…