I've just read about the difference between POSIXlt
and POSIXct
and it is said that POSIXlt is a mixed text and character format like "May, 6 1985", "1990-9-1" or "1/20/2012". When I try such kind of things I get an error
as.POSIXlt("May, 6 1985")
# character string is not in a standard unambiguous format
(How) can we dates with format as quoted above put forward to POSIXlt
? Here are sources saying that such format works (if I get them right): 1, 2.
Read ?strptime
for all the details of specifying a time format. In this case you want %b
(for month name), %d
(day of month), %Y
(4-digit year). (This will only work with an English locale setting as the month names are locale-specific.)
as.POSIXlt("May, 6 1985", format = "%b, %d %Y")