# NOT RUN {
## convert strings to dates
x <- c("2019-01-15", "2019-01-20", "2019-01-21", "2019-01-22")
# check if it is a Date format
is.Date(x)
y <- formatDate(x, "Ymd", "-")
# check if it is a Date format
is.Date(y)
y
## convert numbers to dates
x <- 42705:42710
y <- formatDate(x)
is.Date(y)
y
## get day, month or year
day(y)
month(y)
year(y)
# }
Run the code above in your browser using DataLab