php中的倒数第二天
到目前为止php中的倒数第二天,php,date,strtotime,Php,Date,Strtotime,到目前为止 strtotime('last day of this month'); 给我最后一天(31),但我想要倒数第二天(30),我试过: strtotime('-1 day','last day of this month'); 还包括strotime(“本月最后一天”)-strotime(“1天”);等等。结果总是(用日期()格式化)1969年12月31日 我怎样才能做到这一点呢?你就快到了strottime()在从日期减去时间跨度时,参数2应为整数。所以你需要 使用strotim
strtotime('last day of this month');
给我最后一天(31),但我想要倒数第二天(30),我试过:
strtotime('-1 day','last day of this month');
还包括strotime(“本月最后一天”)-strotime(“1天”);等等。结果总是(用日期()格式化)1969年12月31日
我怎样才能做到这一点呢?你就快到了strottime()在从日期减去时间跨度时,参数2应为整数。所以你需要
strotime(“本月最后一天”)将当月最后一天转换为整数时间戳值
strotime('-1天',strotime('本月最后一天'))
给出了预期的答案
这里有一个与您所问的问题类似的问题:
strotime参考:,以防您发现此答案有用。请随意接受:)祝你快乐!可以同时,我将努力使这个答案对外面的人更有用:)