[R] Units of Difference Between Two Dates

From: Tom La Bone <booboo_at_gforcecable.com>
Date: Thu, 15 May 2008 05:22:21 -0700 (PDT)

I would like all three of these calculations to give an answer in days (or at least the same units):

> as.POSIXct("1971-08-01 00:00:00") - as.POSIXct("1971-08-01 00:00:00")
Time difference of 0 secs
> as.POSIXct("1971-08-01 12:00:00") - as.POSIXct("1971-08-01 00:00:00")
Time difference of 12 hours
> as.POSIXct("1971-09-01 00:00:00") - as.POSIXct("1971-08-01 00:00:00")
Time difference of 31 days

What is the best way to do this?


View this message in context: http://www.nabble.com/Units-of-Difference-Between-Two-Dates-tp17251994p17251994.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 15 May 2008 - 12:25:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 15 May 2008 - 18:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive