Hours in Period
hip.Rd
Given any starting and ending date/time objects, it generates:
1) a vector of class c("POSIXct" "POSIXt") with all the hours between the two date/time objects (both of them included), OR
2) the amount of hours between the two date/time objects
Arguments
- from
Character or POSIXct object indicating the starting date/time for creating the sequence. It has to be in the format indicated by
date.fmt
.- to
Character indicating the ending date/time for creating the sequence. It has to be in the format indicated by
date.fmt
.- date.fmt
character indicating the format in which the date/time objects are stored in
from
andto
, e.g. %Y-%m-%d %H:%M. Seeformat
inas.Date
.
ONLY required whenclass(dates)=="factor"
orclass(dates)=="numeric"
.- out.type
Character indicating the type of result that is given by this function. Valid values are:
1) seq : a vector of class Date with all the days between the two dates, OR
2) nmbr: a single numeric value with the amount of days between the two dates.- tz
specification of the desired time zone yo be used. System-specific (see time zones), but
""
is the current time zone, and"GMT"
(the default value) is UTC (Universal Time, Coordinated). SeeSys.timezone
andas.POSIXct
.
This argument can be used when working with subdaily zoo objects to force using the local time zone instead of GMT as time zone.
Value
Depending on the value of out.type
, it returns:
1) a vector of class c("POSIXct" "POSIXt")
with all the hours between from
and to
(both of them included), OR
2) the amount of hours between the two date/time objects
Author
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
See also
dip
, mip
, yip
, diy
, timeBasedSeq
Examples
## Sequence of hours between "1961-01-01 00:00" and "1961-01-10 00:00", giving the
## starting and ending date/time objects with hours and skipping the minutes (default)
hip("1961-01-01 00", "1961-12-31 00")
## Sequence of hours between "1961-01-01 00:00" and "1961-01-10 00:00", giving the
## starting and ending date/time objects only with hours and minutes(skipping the minutes)
hip("1961-01-01 00:00", "1961-12-31 00:00", date.fmt="%Y-%m-%d %H:%M")
## Number of hours between the 10:00 AM of "1961-Jan-02" and the 11:00 AM of "1961-Jan-01",
## using "%d/%m/%Y" as date/time format.
hip("01/01/1961 10", "02/01/1961 11", date.fmt= "%d/%m/%Y %H", out.type = "nmbr")