1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/timespans.r 3\name{timespan} 4\alias{timespan} 5\alias{timespans} 6\title{Description of time span classes in lubridate} 7\description{ 8A time span can be measured in three ways: as a duration, an interval, or a 9period. 10\itemize{ 11\item \link{duration}s record the exact number of seconds in a time span. 12They measure the exact passage of time but do not always align with 13human measurements like hours, months and years. 14\item \link{period}s record the change in the clock time between two date-times. 15They are measured in human units: years, months, days, hours, minutes, 16and seconds. 17\item \link{intervals} are time spans bound by two real date-times. Intervals can be 18accurately converted to periods and durations. 19} 20} 21\examples{ 22duration(3690, "seconds") 23period(3690, "seconds") 24period(second = 30, minute = 1, hour = 1) 25interval(ymd_hms("2009-08-09 13:01:30"), ymd_hms("2009-08-09 12:00:00")) 26 27date <- ymd_hms("2009-03-08 01:59:59") # DST boundary 28date + days(1) 29date + ddays(1) 30 31date2 <- ymd_hms("2000-02-29 12:00:00") 32date2 + years(1) 33# self corrects to next real day 34 35date3 <- ymd_hms("2009-01-31 01:00:00") 36date3 + c(0:11) * months(1) 37 38span <- date2 \%--\% date #creates interval 39 40date <- ymd_hms("2009-01-01 00:00:00") 41date + years(1) 42date - days(3) + hours(6) 43date + 3 * seconds(10) 44 45months(6) + days(1) 46} 47\keyword{chron} 48\keyword{classes} 49