ez.time | R Documentation |
convert from a time (numeric, character/factor, hms/difftime) to class (chron) times (17:48:00–h:m:s military only) or to class numeric (0.7416667–fractions of a day), call times
:
SPSS military time (civilian time not supported) specified in date format, 17:48 read into R as 64080 (seconds of a day, foreign package), or as hms/difftime (same as SPSS, haven package), or
Excel military/civilian time specified in time format, 5:48:00 PM, 17:48:00 read into R as 0.7416667 (fractions of a day), or
Pass directly a string "17:48:00" (format specified by param format)
ez.time(x, ori = "SPSS", format = "%H:%M", out.type = "numeric", ...)
x |
a vector of number or character, hms/difftime |
ori |
one of 'Excel', 'SPSS' (ignored if x is character) |
format |
input format, see examples (more formats at |
out.type |
string, 'numeric' (fractions of a day) or 'times'/'time' |
returns a vector of number (class numeric) or time (class times). class times can be passed to as.character(.), or substr(.,1,5), or as.numeric(.), see more at chron
chron stores as a fraction of a day, if you do as.numeric
ez.date
ez.is.date
ez.is.date.like
ez.age
ez.time
ez.time("5:20:31 am",format="%I:%M:%S %p",out.type="time") # 5, 05; am AM aM Am OK. %I = 12 hr
ez.time("15:32", format="%H:%M",out.type="time") # 5 05 OK.
ez.time("5:2", format="%H:%M",out.type="time")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.