clock | R Documentation |
Clock class
clock(...)
... |
date parts, must be supplied in order (i.e., if you want to give
seconds, you must give all others first): year, month, day, hour, minutes,
seconds. uses |
Methods These must be called with parens
now(tzone = "")
Get the date time right now
param tzone
: a valid time zone
date()
Same as $now() but as a Date
class
utc()
Same as $now() but with time zone set to UTC
Active Methods These are called without parens
time
Get the current time or the time you set on initialize
year
Get the year component of the time
month
Get the month component of the time
day
Get the day component of the time
hour
Get the hour component of the time
min
Get the minute component of the time
sec
Get the seconds component of the time
utc_offset
Get the utc offset
unix_epoch
Get the time in seconds since unix epoch
a POSIXct object
# if no time set when initialized ## uses current time when you call functions with parens x <- clock(2009) x ## and uses current time when you call active functions x$utc x$date x$year x$month # if time set when initialized ## ignores that time when calling functions with parens z <- clock(2009, 3, 13) z z$utc ## and uses the user set time when you call active functions z$year z$month z$utc_offset z$unix_epoch # clock(2009)$time clock(2009, 3, 13)$time clock(2009, 3, 13, 1, 4, 53)$time now() now("UTC")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.