脚本宝典收集整理的这篇文章主要介绍了php – 在每次迭代中添加一个月的时间戳,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
现在问题是例如我的开始时间戳代表01.07.2011
并且在循环中我只添加30天的时间戳,然后我选择框7月将显示两次.
如果我加上31天,那么可能会是一个月.
<select name="checkinMonth" class="selectform" id="checkinMonth" > <?PHP for($month = $checkin_timestamp; $month <= $checkout_timestamp; $month += 30*60*60*24) { $checkin_month = getdate($month); $option_text = strftime("%B %Y",$month); $option_value = strftime("%Y%m",$month); $selected = ($checkin_selected == $option_value ? "selected='selected'" : ""); echo "<option value='{$option_value}' {$selected}>{$option_text}</option>"; } ?> </select>
strtotime("+1 month",$myTimestamp);
以上是脚本宝典为你收集整理的php – 在每次迭代中添加一个月的时间戳全部内容,希望文章能够帮你解决php – 在每次迭代中添加一个月的时间戳所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。