ble and the names of the base time zone and the alternate (daylight-
saving) time zone. Sometimes this may just be of length one, giving the [ time
zone ](/link/time%20zone?package=base&version=3.6.2) name.

` "POSIXct" ` objects may also have an attribute ` "tzone" ` , a character
vector of length one. If set to a non-empty value, it will determine how the
object is converted to class ` "POSIXlt" ` and in particular how it is
printed. This is usually desirable, but if you want to specify an object in a
particular time zone but to be printed in the current time zone you may want
to remove the ` "tzone" ` attribute (e.g., by ` c(x) ` ).

Unfortunately, the conversion is complicated by the operation of time zones
and leap seconds (according to this version of  R  's data, 26 days have been
86401 seconds long so far, the last being on (actually, immediately before)
2015-07-01 : the times of the extra seconds are in the object ` .leap.seconds
` ). The details of this are entrusted to the OS services where possible. It
seems that some rare systems used to use leap seconds, but all known current
platforms ignore them (as required by POSIX). This is detected and corrected
for at build time, so ` "POSIXct" ` times used by  R  do not include leap
seconds on any platform.

Using ` [ c ](/link/c?package=base&version=3.6.2) ` on ` "POSIXlt" ` objects
converts them to the current time zone, and on ` "POSIXct" ` objects drops any
` "tzone" ` attributes (even if they are all marked with the same time zone).

A few times have specific issues. First, the leap seconds are ignored, and
real times such as ` "2005-12-31 23:59:60" ` are (probably) treated as the
next second. However, they will never be generated by  R  , and are unlikely
to arise as input. Second, on some OSes there is a problem in the POSIX/C99
standard with ` "1969-12-31 23:59:59 UTC" ` , which is ` -1 ` in calendar time
and that value is on those OSes also used as an error code. Thus `
as.POSIXct("1969-12-31 23:59:59", format = "%Y-%m-%d %H:%M:%S", tz = "UTC") `
may give ` NA ` , and hence ` as.POSIXct("1969-12-31 23:59:59", tz = "UTC") `
will give ` "1969-12-31 23:59:00" ` . Other OSes (including the code used by
R  on Windows) report errors separately and so are able to handle that time as
valid.

The print methods respect ` [ options
](/link/options?package=base&version=3.6.2) ("max.print") ` .

##  References

Ripley, B. D. and Hornik, K. (2001) Date-time classes. _R News_ , **1/2** , 8
--11. [ https://www.r-project.org/doc/Rnews/Rnews_2001-2.pdf
](https://www.r-project.org/doc/Rnews/Rnews_2001-2.pdf)

##  See Also

[ Dates ](/link/Dates?package=base&version=3.6.2) for dates without times.

` [ as.POSIXct ](/link/as.POSIXct?package=base&version=3.6.2) ` and ` [
as.POSIXlt ](/link/as.POSIXlt?package=base&version=3.6.2) ` for conversion
between the classes.

` [ strptime ](/link/strptime?package=base&version=3.6.2) ` for conversion to
and from character representations.

` [ Sys.time ](/link/Sys.time?package=base&version=3.6.2) ` for clock time as
a ` "POSIXct" ` object.

` [ difftime ](/link/difftime?package=base&version=3.6.2) ` for time
intervals.

` [ cut.POSIXt ](/link/cut.POSIXt?package=base&version=3.6.2) ` , ` [
seq.POSIXt ](/link/seq.POSIXt?package=base&version=3.6.2) ` , ` [ round.POSIXt
](/link/round.POSIXt?package=base&version=3.6.2) ` and ` [ trunc.POSIXt
](/link/trunc.POSIXt?package=base&version=3.6.2) ` for methods for these
classes.

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

##  Examples

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

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