Year(x)
Quarter(x)
Month(x, fmt = c("m", "mm", "mmm"), lang = c("local", "engl"),
stringsAsFactors = TRUE)
Week(x, method = c("iso", "us"))
Day(x)
Weekday(x, fmt = c("d", "dd", "ddd"), lang = c("local", "engl"),
stringsAsFactors = TRUE)
YearDay(x)
YearMonth(x)
Day(x) <- value
IsWeekend(x)
IsLeapYear(x)
Hour(x)
Minute(x)
Second(x)
Now()
Today()
DiffDays360(start_d, end_d, method = c("eu", "us"))
LastDayOfMonth(x)
DiffDays360
."eu", "us"
, setting either European or US-Method calculation mode. Default is "eu"
.format()
and its strange codes...
Based on the requested time component, the output is as follows:
Year returns the year of the input date in yyyy format.
Quarter returns the quarter of the year (1 to 4) for the input date.
Month returns the month of the year (1 to 12) for the input date.
Week returns the week of the year for the input date (0 to 53), as defined in ISO8601.
Weekday returns the week day of the input date. (1 - Monday, 2 - Tuesday, ... 7 - Sunday). (Names and abbreviations are either english or in the current locale!)
YearDay returns the day of the year numbering (1 to 366).
Day returns the day of the month (1 to 31).
YearMonth returns the yearmonth representation (yyyymm) of a date as long integer.
Hour, Minute Second return the hour, minute resp. second from a Posixlt object.
Today, Now return the current date, resp. the current date and time.
IsWeekend returns TRUE, if the date x falls on a weekend.
IsLeapYear returns TRUE, if the year of the date x is a leap year.
The day can not only be extracted, but as well be defined. See examples.
DiffDays360 calculates the difference between 2 dates using the 360-days convention.
LastDayOfMonth returns the last day of the month of the given date(s).strptime
, DateTimeClasses
, as.POSIXlt
x <- Today() # the same as Sys.Date() but maybe easier to remember..
Year(x)
Quarter(x)
Month(x)
Month(x, fmt = "mm", lang="engl")
Month(x, fmt = "mm", lang="local")
Month(x, fmt = "mmm", lang="engl")
Month(x, fmt = "mmm", lang="local")
Week(x)
Day(x)
Day(x) <- 20
x
Weekday(x)
Weekday(x, fmt = "dd", lang="engl")
Weekday(x, fmt = "dd", lang="local")
Weekday(x, fmt = "ddd", lang="engl")
Weekday(x, fmt = "ddd", lang="local")
YearDay(x)
IsWeekend(x)
IsLeapYear(x)
# let's generate a time sequence by weeks
Month(seq(from=as.Date(Sys.Date()), to=Sys.Date()+150, by="weeks"), fmt="mm")
LastDayOfMonth(as.Date(c("2014-10-12","2013-01-31","2011-12-05")))
Run the code above in your browser using DataLab