【发布时间】:2013-01-16 03:38:23
【问题描述】:
我正在尝试让 stripe 在用户选择的月份中的任何一天的下一次出现时设置 end_trial 日期。即如果今天是 16 号并且用户选择了 15 号,我需要下个月 15 号的 unix 时间戳。但是,如果今天是 14 号,我需要明天的时间戳。
我尝试了在这个 SO 问题 Find the date for next 15th using php 上找到的解决方案。
当我运行该问题中建议的代码并将 15 替换为 31 时
$nextnth = mktime(0, 0, 0, date('n') + (date('j') >= 31), 31);
echo date('Y-m-d', $nextnth);
结果是2013-03-03
我也试过这个Get the date of the next occurrence of the 18th。
当我在 2013-1-31 运行它时,第二个实际上会给我 2013-03-31。
两者都有意想不到的结果。 2月有问题吗?任何指导将不胜感激。
【问题讨论】:
标签: php stripe-payments