### Name: format.Date ### Title: Date Conversion Functions to and from Character ### Aliases: format.Date as.character.Date as.Date as.Date.character ### as.Date.default as.Date.factor as.Date.POSIXct as.Date.POSIXlt ### as.Date.date as.Date.dates as.Date.numeric ### Keywords: utilities chron ### ** Examples ## locale-specific version of the date format(Sys.Date(), "%a %b %d") ## read in date info in format 'ddmmmyyyy' ## This will give NA(s) in some locales; setting the C locale ## as in the commented lines will overcome this on most systems. ## lct <- Sys.getlocale("LC_TIME"); Sys.setlocale("LC_TIME", "C") x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960") z <- as.Date(x, "%d%b%Y") ## Sys.setlocale("LC_TIME", lct) z ## read in date/time info in format 'm/d/y' dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92") as.Date(dates, "%m/%d/%y") ## date given as number of days since 1900-01-01 (a date in 1989) as.Date(32768, origin="1900-01-01")