1

我正在尝试更广泛地使用data.table并且ITime是 UDT 复制 POSIXlt“DateTime”类型。

> strptime("01-04-2012 09:23:45.987364", format="%d-%m-%Y %H:%M:%OS")
[1] "2012-04-01 09:23:45.987364"
> time = strptime("01-04-2012 09:23:45.987364", format="%d-%m-%Y %H:%M:%OS")
> class(time)
[1] "POSIXlt" "POSIXt" 

但我无法使用 ITime 获得 ms 或 micro

> time = as.ITime("09:23:45.987364", format="%H:%M:%OS")
> time
[1] "09:23:45"

如何使用 ITime 处理分数?干杯

4

1 回答 1

4

似乎不可能。

IDateTime {data.table}  R Documentation
Integer based date class


Details

ITime is a time-of-day class stored as the integer number of seconds in the day. as.ITime does not allow days longer than 24 hours. Because ITime is stored in seconds, you can add it to a POSIXct object, but you should not add it to a Date object.
于 2012-11-23T20:30:21.147 回答