ID EN
Date & Time

DateTimeClasses

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Deskripsi kelas "POSIXlt" dan "POSIXct" yang mewakili tanggal dan waktu kalender.

Syntax

R
# S3 method for POSIXct
print(x, tz = "", usetz = TRUE, max = NULL, &#8230;)<p></p><p># S3 method for POSIXct
summary(object, digits = 15, &#8230;)</p><p><code>time + z</code>
<code>z + time</code>
<code>time - z</code>
<code>time1 lop time2</code></p>

Arguments

Parameter Deskripsi
x, object an object to be printed or summarized from one of the date-time classes.
tz, usetz for timezone formatting, passed to format.POSIXct.
max numeric or NULL, specifying the maximal number of entries to be printed. By default, when NULL, getOption("max.print") used.
digits number of significant digits for the computations: should be high enough to represent the least important time unit exactly.
&#8230; further arguments to be passed from or to other methods.
time date-time objects
time1, time2 date-time objects or character vectors. (Character vectors are converted by as.POSIXct.)
z a numeric vector (in seconds)
lop one of ==, !=, <, <=, > or >=.

Details

Ada dua kelas dasar tanggal/waktu. Kelas "POSIXct" mewakili jumlah detik (yang ditandatangani) sejak awal tahun 1970 (dalam zona waktu UTC) sebagai vektor numerik. Kelas "POSIXlt" adalah daftar vektor bernama yang mewakili detik0--61: detik. menit0--59: menit. jam0--23: jam. mday1--31: hari dalam sebulan mon0--11: bulan setelah awal tahun. tahuntahun sejak 1900. wday0--6 hari dalam seminggu, dimulai pada hari Minggu. yday0--365: hari dalam setahun. isdst Bendera Waktu Musim Panas. Positif jika berlaku, nol jika tidak, negatif jika tidak diketahui. zona(Opsional.) Singkatan dari zona waktu yang berlaku pada saat itu: "" jika tidak diketahui (tetapi "" mungkin juga digunakan untuk UTC). gmtoff(Opsional.) Offset dalam hitungan detik dari GMT: nilai positif berada di sebelah timur meridian. Biasanya NA kalau tidak diketahui, tapi 0 bisa berarti

Contoh

Example
R
# NOT RUN {
<!-- % <--> may fail / be platform dependent -->
(z <- Sys.time())             # the current date, as class "POSIXct"

Sys.time() - 3600             # an hour ago

as.POSIXlt(Sys.time(), "GMT") # the current time in GMT
format(.leap.seconds)         # the leap seconds in your time zone
print(.leap.seconds, tz = "PST8PDT")  # and in Seattle's
# }
# NOT RUN {
<!-- % ..test should be diffable from here on: -->
# }
# NOT RUN {
## look at *internal* representation of "POSIXlt" :
leapS <- as.POSIXlt(.leap.seconds)
names(leapS) ; is.list(leapS)
## str() "too smart" -->  need unclass(.):
utils::str(unclass(leapS), vec.len = 7)
## Extracting *single* components of POSIXlt objects:
leapS[1 : 5, "year"]

##  length(.) <- n   now works for "POSIXct" and "POSIXlt" :
for(lpS in list(.leap.seconds, leapS)) {
    ls <- lpS; length(ls) <- 12
    l2 <- lpS; length(l2) <- 5 + length(lpS)
    stopifnot(exprs = {
      ## length(.) <- * is compatible to subsetting/indexing:
      identical(ls, lpS[seq_along(ls)])
      identical(l2, lpS[seq_along(l2)])
      ## has filled with NA's
      is.na(l2[(length(lpS)+1):length(l2)])
    })
}
# }
# NOT RUN {
<!-- % for -->
# }

See Also

Dates for dates without times. as.POSIXct and as.POSIXlt for conversion between the classes. strptime for conversion to and from character representations. Sys.time for clock time as a "POSIXct" object. difftime for time intervals. cut.POSIXt seq.POSIXt round.POSIXt and trunc.POSIXt for methods for these classes. weekdays for convenience extraction functions.