On Mar 10, 2010, at 3:29 PM, GULATI, BRIJESH (Global Markets FF&O NY) wrote:

> Is there easy way to convert numeric to date?
> 
> For example:
> 
> If I have, 
> 
>       a = as.Date("2010-03-04")
> 
> And, if run
> 
>> as.numeric(a)
> [1] 14672
> 
> Is there any function that I can use to convert 14672 back to the date.
> 
> Thx in advance, 
> Brijesh


> as.Date(14672, origin = "1970-01-01")
[1] "2010-03-04"


Of course, you would have to know that R stores dates internally as the number 
of days since 1970-01-01, which is curiously not defined in the help page for 
?as.Date, but is on ?Date, which is in the See Also of the former.

HTH,

Marc Schwartz

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to