[R] question about difference in date objects
Karl Ove Hufthammer
karl at huftis.org
Mon Nov 2 12:36:59 CET 2009
On Mon, 02 Nov 2009 06:29:54 -0500 Phil Smith
<philipsmith at alumni.albany.edu> wrote:
> I want to take the difference in two dates:
>
> dt2 - dt1.
>
> But, I want the answer in months between those 2 dates.
What do you mean by 'months'? The number of days in a month vary, so the
number of months between two dates is not defined. But if you're willing
to think of a month as 30 days, you just have to divide by 30:
d=dt2-dt1
d/30
or
as.numeric(d)/30
if you want to avoid the (wrong) textual description.
--
Karl Ove Hufthammer
More information about the R-help
mailing list