[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  Dates: Date Class

##  Description

Description of the class ` "Date" ` representing calendar dates.

##  Usage

    
    
    # S3 method for Date
    summary(object, digits = 12, …)
    
    # S3 method for Date
    print(x, max = NULL, …)
    
    

##  Arguments

object, x

a ` Date ` object to be summarized or printed.

digits

number of significant digits for the computations.

max

numeric or ` NULL ` , specifying the maximal number of entries to be printed.
By default, when ` NULL ` , ` [ getOption
](/link/getOption?package=base&version=3.6.2) ("max.print") ` used.

…

further arguments to be passed from or to other methods.

##  Details

Dates are represented as the number of days since 1970-01-01, with negative
values for earlier dates. They are always printed following the rules of the
current Gregorian calendar, even though that calendar was not in use long ago
(it was adopted in 1752 in Great Britain and its colonies).

It is intended that the date should be an integer, but this is not enforced in
the internal representation. Fractional days will be ignored when printing. It
is possible to produce fractional days via the ` mean ` method or by adding or
subtracting (see ` [ Ops.Date ](/link/Ops.Date?package=base&version=3.6.2) `
).

From the many methods, see ` methods(class = "Date") ` , a few are documented
separately, see below.

##  See Also

` [ Sys.Date ](/link/Sys.Date?package=base&version=3.6.2) ` for the current
date.

` [ weekdays ](/link/weekdays?package=base&version=3.6.2) ` for convenience
extraction functions.

Methods with extra arguments and documentation:

` [ Ops.Date ](/link/Ops.Date?package=base&version=3.6.2) `

    

for operators on ` "Date" ` objects.

` [ format.Date ](/link/format.Date?package=base&version=3.6.2) `

    

for conversion to and from character strings.

` [ axis.Date ](/link/axis.Date?package=base&version=3.6.2) `

    

and ` [ hist.Date ](/link/hist.Date?package=base&version=3.6.2) ` for
plotting.

` [ seq.Date ](/link/seq.Date?package=base&version=3.6.2) `

    

, ` [ cut.Date ](/link/cut.Date?package=base&version=3.6.2) ` , and ` [
round.Date ](/link/round.Date?package=base&version=3.6.2) ` for utility
operations.

` [ DateTimeClasses ](/link/DateTimeClasses?package=base&version=3.6.2) ` for
date-time classes.

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2FDates&utm_source=r-docs&utm_medium=docs&utm_term=Dates&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    (today <- Sys.Date())
    format(today, "%d %b %Y")  # with month as a word
    (tenweeks <- seq(today, length.out=10, by="1 week")) # next ten weeks
    weekdays(today)
    months(tenweeks)
    # }
    # NOT RUN {
    <!-- % dont -->
    # }
    # NOT RUN {
    (Dls <- as.Date(.leap.seconds))
    
    ##  length(<Date>) <- n   now works
    ls <- Dls; length(ls) <- 12
    l2 <- Dls; length(l2) <- 5 + length(Dls)
    stopifnot(exprs = {
      ## length(.) <- * is compatible to subsetting/indexing:
      identical(ls, Dls[seq_along(ls)])
      identical(l2, Dls[seq_along(l2)])
      ## has filled with NA's
      is.na(l2[(length(Dls)+1):length(l2)])
    })
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2FDates&utm_source=r-docs&utm_medium=docs&utm_term=Dates&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)