> d <- c('2013-12-05 18:43:00','2013-08-23 22:29:00') > difftime(d[2],d[1]) Time difference of -103.8431 days > strptime(d, "%Y-%m-%d %H:%M:%S") [1] "2013-12-05 18:43:00 JST" "2013-08-23 22:29:00 JST" > difftime(strptime(d, "%Y-%m-%d %H:%M:%S")[2],strptime(d, "%Y-%m-%d %H:%M:%S")[1]) Time difference of -103.8431 days > difftime(strptime(d, "%Y-%m-%d %H:%M:%S")[2],strptime(d, "%Y-%m-%d %H:%M:%S")[1],units='secs') Time difference of -8972040 secs 复制代码 推荐一下 stackoverflow,确实是个好学习之处。 http://stackoverflow.com/questions/12649641/calculating-time-difference-in-rr