atiny.link
Paste Contents
Expires in 219 days 5 hours 5 minutes

Small tyop here, $date->format should probably be $now->format –

Patrick

 Jan 11, 2015 at 22:18

While I appreciate the link to PHP Documentation, it would be nice to describe what the parameters in your example do. You linked to the DateTime::add function, which takes the parameter of DateInterval whose doc then says to refer to the formats supported by the DateTime constructor which then points to "Date and Time Formats" which then links to "Time Formats", "Date Formats", "Compound Formats" and "Relative Formats". None of these seem to mention P, though I could very well have missed it in all those pages. I get that T means time, H hours, but P?.... –

s.co.tt

 Apr 22, 2021 at 23:55

@s.co.tt php.net/manual/en/dateinterval.construct.php The format starts with the letter P, for period. Each duration period is represented by an integer value followed by a period designator. If the duration contains time elements, that portion of the specification is preceded by the letter T. –

FAjir

 Apr 24, 2021 at 11:28

Thanks! I did figure it out, and please note I was irritated with the PHP docs, not the poster. But I'm glad your answer is here for posterity! –

s.co.tt

 Jun 6, 2021 at 16:44