|
DateTimeImmutable::subSubtracts an amount of days, months, years, hours, minutes and seconds Description
public DateTimeImmutable DateTimeImmutable::sub(DateInterval
$interval )Returns a new DateTimeImmutable object, with the specified DateInterval object subtracted from the specified DateTimeImmutable object. Parameters
Return ValuesReturns a new DateTimeImmutable object with the modified data. Errors/Exceptions
If an unsupported operation is attempted, such as using a
DateInterval object representing relative time
specifications such as Changelog
ExamplesExample #1 DateTimeImmutable::sub example Object-oriented style
The above examples will output: 2000-01-10 Example #2 Further DateTimeImmutable::sub examples
The above example will output: 2000-01-19 13:59:30 1992-08-15 19:56:58 Example #3 Beware when subtracting months
The above example will output: 2001-03-30 2001-03-02 See Also
|