Re: [R] Problem with as.POSIXlt$hour

From: David Winsemius <>
Date: Tue, 15 Jun 2010 09:54:17 -0400

On Jun 15, 2010, at 7:45 AM, PtitBleu wrote:

> Hello,
> In one of my functions, I need to extract the hour from a date.
> For example:
> as.POSIXlt("2010-03-27 02:00:00")$hour gives 2 as expected.
> It works for all the dates I've tested except the following one
> which is in
> my list of dates:
> as.POSIXlt("2010-03-28 02:00:00")$hour which gives 0.
> I don't understand why it doesn't work with this particular date.

It "works" for me with a result of 2, so I suspect it has something to do with whether that hour even "exists" during the shift from "ordinary" time to daylight savings time in your LOCALE (which was not offered but would be plausibly near GMT/UMT given the domain from which you are posting).
> Any idea ?
> Thanks in advance,
> Ptit Bleu (with R 2.9.0 under Windows ). ...

... wrong info for this question, I suspect.

David Winsemius, MD
West Hartford, CT

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 15 Jun 2010 - 13:56:30 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 Tue 15 Jun 2010 - 19:20:30 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive