Extract time from timestamp?

前端 未结 4 584
闹比i
闹比i 2020-12-11 17:28

Essentially, I want only the hour, minute, and seconds from a column of timestamps I have in R, because I want to view how often different data points occur throughout diffe

4条回答
  •  清歌不尽
    2020-12-11 18:18

    Just

    x <- '2008-08-07T17:07:36Z'
    substr(x, 12, 19)
    #[1] "17:07:36"
    

    ...will do it if the timestamp is consistent, which I imagine it would be given it is an ISO_8601 ( https://en.wikipedia.org/wiki/ISO_8601 ) string.

提交回复
热议问题