为什么POSIXlt之间的差异有小数部分,而日期之间的差异没有?
示例:
as.POSIXlt("2015-12-10",format = "%Y-%m-%d")-as.POSIXlt("2015-10-07",format = "%Y-%m-%d")返回64.04167
as.Date("2015-12-10",format = "%Y-%m-%d")-as.Date("2015-10-07",format = "%Y-%m-%d")返回64 (正确的值)
为什么会有不同的行为?
发布于 2020-08-21 10:36:47
这些小数正好是一个小时,发生在从DST转换过程中。
0.04167 * 24
#[1] 1.00008
#some rounding error指定一个没有DST的时区,您将得到以下内容:
as.POSIXlt("2015-12-10",format = "%Y-%m-%d", tz = "GMT")-
as.POSIXlt("2015-10-07",format = "%Y-%m-%d", tz = "GMT")
#Time difference of 64 dayshttps://stackoverflow.com/questions/63521132
复制相似问题