|
The DateInterval classIntroductionRepresents a date interval. A date interval stores either a fixed amount of time (in years, months, days, hours etc) or a relative time string in the format that DateTimeImmutable's and DateTime's constructors support. More specifically, the information in an object of the DateInterval class is an instruction to get from one date/time to another date/time. This process is not always reversible. A common way to create a DateInterval object is by calculating the difference between two date/time objects through DateTimeInterface::diff. Since there is no well defined way to compare date intervals, DateInterval instances are incomparable. Class synopsis
DateInterval
/* Properties */
public
int
$y;
public
int
$m;
public
int
$d;
public
int
$h;
public
int
$i;
public
int
$s;
public
float
$f;
public
int
$invert;
public
mixed
$days;
public
bool
$from_string;
public
string
$date_string;
/* Methods */
public __construct(string
$duration )public static DateIntervalfalse createFromDateString(string
$datetime )public string format(string
$format )PropertiesWarning
The available properties listed below depend on PHP version, and should be considered as readonly.
Changelog
|