[pmwiki-users] ftime odd behaviour just on 31st (or so)

Petko Yotov 5ko at 5ko.fr
Wed Aug 31 10:04:36 CDT 2016


This is a known bug/feature with the strtotime() PHP function:

   https://derickrethans.nl/obtaining-the-next-month-in-php.html
   http://php.net/manual/en/function.strtotime.php#107331 (and next)

There are some hints for solutions on these pages, but unfortunately the 
PHP version on pmwiki.org is a little old and does not support them.

The following work as expected in PHP 5.5, PHP 5.6 and PHP 7:

* {(ftime fmt="%b" when="first day of last month -2months")}
* {(ftime fmt="%b" when="first day of last month -1month")}
* {(ftime fmt="%b" when="first day of last month")}
* {(ftime fmt="%b %Y")}
* {(ftime fmt="%b" when="first day of next month")}
* {(ftime fmt="%b" when="first day of next month +1month")}
* {(ftime fmt="%b" when="first day of next month +2months")}

Petko

---
Change log     :  http://www.pmwiki.org/wiki/PmWiki/ChangeLog
Release notes  :  http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
If you upgrade :  http://www.pmwiki.org/wiki/PmWiki/Upgrades


On 2016-08-31 13:36, kirpi at kirpi.it wrote:
> On the 31st of August (possibly on every 31st or perhaps on every last
> day of a month, I am not sure) there is an odd result to this markup
> 
> * {(ftime fmt="%b" "-2 month")}
> * {(ftime fmt="%b" "-1 month")}
> * {(ftime fmt="%b %Y")}
> * {(ftime fmt="%b" "+1 month")}
> * {(ftime fmt="%b" "+2 month")}
> * {(ftime fmt="%b" "+3 month")}
> 
> resulting in something like:
> 
> * Jul
> * Jul
> * Aug 2016
> * Oct
> * Oct
> * Dec
> 
> I just tested and documented in
> http://www.pmwiki.org/wiki/PmWiki/MarkupExpressions-Talk



More information about the pmwiki-users mailing list