[R] time between two dates

Sebastian Schubert schubert.seb at googlemail.com
Fri Mar 9 10:17:25 CET 2012


On 09/03/12 10:04, carol white wrote:
> Dear All,
> It may be a trivial question but how to determine the number of days between two dates? What I want to do is to subtract two dates by a function which returns the number of days between these two dates. 
> 
> 11.11.2008-11.11.2006 ~= 730 days


> start <- strptime("20061111", format="%Y%m%d")
> end <- strptime("20081111", format="%Y%m%d")
> end-start
Time difference of 731 days

HTH
Sebastian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120309/b908a170/attachment.bin>


More information about the R-help mailing list