[R] POSIXlt and months
Gabor Grothendieck
ggrothendieck at gmail.com
Tue Sep 3 13:57:31 CEST 2013
On Tue, Sep 3, 2013 at 7:31 AM, Terry Therneau <therneau at mayo.edu> wrote:
> The help page for as.POSIXlt suggests using it as a way to extract month,
> day, and year.
> However, I can't find any documentation on the results and am a bit
> surprised by the month portion.
>
> An example, run about 6:21 AM on Sept 3.
>
>> unlist(unclass(as.POSIXlt(Sys.time())))
>
> sec min hour mday mon year wday
> yday
> 43.24545 21.00000 6.00000 3.00000 8.00000 113.00000 2.00000
> 245.00000
> isdst
> 1.00000
>
>
> So: it appears that I need to
> add 1900 to year
> add 1 to month
> but other components are as I would expect.
>
>> unlist(unclass(as.POSIXlt(as.Date("1953/03/10"))))
> sec min hour mday mon year wday yday isdst
> 0 0 0 10 2 53 2 68 0
>
> Supports a 0 origin for everything except year and mday.
>
> A pointer to formal documentation of this would make me feel easier about
> using the function.
?DateTimeClasses
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list