Dates and Times Flashcards
as.Date(s) and as.POSIXct(s)
as.Date(s) and as.POSIXct(s) convert to the respective class; format(dt) converts to a string representation. The default string format is “2001-02-21”.
%a, %A
Abbreviated and full weekday name.
%b, %B
Abbreviated and full month name.
%d
Day of the month (01–31).
%H
Hours (00–23).
%I
Hours (01–12).
%j
Day of year (001–366).
%m
Month (01–12).
%M
Minute (00–59).
%p
AM/PM indicator.
%S
Second as decimal number (00–61).
%U
Week (00–53); the first Sunday as day 1 of week 1.
%w
Weekday (0–6, Sunday is 0).
%W
Week (00–53); the first Monday as day 1 of week 1.
%y
Year without century (00–99). Don’t use.
%Y
Year with century.
%z
(output only.) Offset from Greenwich; -0800 is 8 hours west of.
%Z
(output only.) Time zone as a character string (empty if not available).