ID EN
Date & Time

Dates

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Deskripsi kelas "Tanggal" yang mewakili tanggal kalender.

Syntax

R
# S3 method for Date
summary(object, digits = 12, &#8230;)<p></p><p># S3 method for Date
print(x, max = NULL, &#8230;)
<!-- % not sure if we should not rather _drop_ the 'recursive'! -->
<!-- %\method{c}{Date}(\dots, recursive = FALSE) --></p>

Arguments

Parameter Deskripsi
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("max.print") used.
&#8230; further arguments to be passed from or to other methods.

Details

Tanggal direpresentasikan sebagai jumlah hari sejak 01-01-1970, dengan nilai negatif untuk tanggal-tanggal sebelumnya. Pencetakannya selalu mengikuti aturan kalender Gregorian saat ini, meskipun kalender tersebut sudah lama tidak digunakan (diadopsi pada tahun 1752 di Inggris Raya dan koloninya). Hal ini dimaksudkan agar tanggal harus berupa bilangan bulat, tetapi hal ini tidak diterapkan dalam representasi internal. Hari pecahan akan diabaikan saat mencetak. Hari pecahan dapat dibuat melalui metode rata-rata atau dengan menambahkan atau mengurangi (lihat Tanggal Operasi). Dari sekian banyak metode, lihat metode (kelas = "Tanggal"), beberapa didokumentasikan secara terpisah, lihat di bawah.

Contoh

Example
R
# 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)])
})
# }

See Also

Sys.Date for the current date. weekdays for convenience extraction functions. Methods with extra arguments and documentation: Ops.Datefor operators on "Date" objects.format.Datefor conversion to and from character strings.axis.Dateand hist.Date for plotting.seq.Date cut.Date and round.Date for utility operations. DateTimeClasses for date-time classes.