Search notes:

R function: as.Date

as.Date converts from a character representation of a date to an object whose class is Date.
a_date <- as.Date("2014-06-26")

a_date
# [1] "2014-06-26"

a_date + 1   # one day later
# [1] "2014-06-27"

another_date <- as.Date("08/28/1970", format="%m/%d/%Y")
another_date
# [1] "1970-08-28"

mode(a_date)
# [1] "numeric"

length(a_date)
# [1] 1

class(a_date)
# [1] "Date"
Github repository about-r, path: /functions/as.Date/as.Date.R

origin

The origin parameter specifies a starting date from which the number is added:
dt <- as.Date(20, origin='2018-05-01');
dt;
#
#  "2018-05-21"
Github repository about-r, path: /functions/as.Date/origin.R

See also

Index to (some) R functions
Date class

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745526350, '3.17.57.190', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/as_Date(76): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78