as.POSIXct with datetimes including midnight

前端 未结 4 1815
醉话见心
醉话见心 2020-12-12 00:47

I am wanting to convert date-times stored as characters to date-time objects. However if a date time includes midnight then the resulting datetime object excludes the time c

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 01:31

    I prefer to use the lubridate package for date-times. It does not seem to cause problems here either:

    example.dates <- c("2011-11-02 00:31:00","2011-11-02 00:00:00","2011-11-02 00:20:22")
    library(lubridate)
    ymd_hms(example.dates)
    

提交回复
热议问题