Date and Time
Date and Time
Date is represented by Date
class. Date is stored as number of days since 1970-01-01.
Time is represented by POSIXct
(represents date as large integer) or POSIXlt
(represents date as list of values) classes. Time is stored as number of seconds since 1970-01-01.
Dates
Get current time.
Get system date.
Formatting and Parsing
We can use format function to format dates.
Create dates from vector
Have a look here for help with formatting strings.
After the strings are converted to Date type, we can, for example, easily find the difference in days.
Or, for example do the following.
lubridate package
We can use lubridate package to work with dates.
Then we can use functions like:
More info about the package is here.
Last updated