The R Project SVN R

Rev

Rev 82360 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 82360 Rev 85990
Line 48... Line 48...
48
  \code{\link{DateTimeClasses}}, \code{\link{Date}}
48
  \code{\link{DateTimeClasses}}, \code{\link{Date}}
49
}
49
}
50
 
50
 
51
\examples{
51
\examples{
52
round(.leap.seconds + 1000, "hour")
52
round(.leap.seconds + 1000, "hour")
53
## IGNORE_RDIFF_BEGIN
53
\dontdiff{
54
         trunc(Sys.time(), "day")
54
         trunc(Sys.time(), "day")
55
(timM <- trunc(Sys.time() -> St, "months")) # shows timezone
55
(timM <- trunc(Sys.time() -> St, "months")) # shows timezone
56
(datM <- trunc(Sys.Date() -> Sd, "months"))
56
(datM <- trunc(Sys.Date() -> Sd, "months"))
57
(timY <- trunc(St, "years")) # + timezone
57
(timY <- trunc(St, "years")) # + timezone
58
(datY <- trunc(Sd, "years"))
58
(datY <- trunc(Sd, "years"))
59
## IGNORE_RDIFF_END
59
}
60
stopifnot(inherits(datM, "Date"), inherits(timM, "POSIXt"),
60
stopifnot(inherits(datM, "Date"), inherits(timM, "POSIXt"),
61
          substring(format(datM), 9,10) == "01", # first of month
61
          substring(format(datM), 9,10) == "01", # first of month
62
          substring(format(datY), 6,10) == "01-01", # Jan 1
62
          substring(format(datY), 6,10) == "01-01", # Jan 1
63
          identical(format(datM), format(timM)),
63
          identical(format(datM), format(timM)),
64
          identical(format(datY), format(timY)))
64
          identical(format(datY), format(timY)))