DateInterval 如何减少时间
比如这个代码是获取当前时间加上3个小时,那么如何获取减少3个小时呢?
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->(new \DateTime('NOW'))->add(new \DateInterval('PT3H'))------解决方案--------------------
dateinterval::format() - formats the interval
datetime::add() - adds an amount of days, months, years, hours, minutes and seconds to a datetime object
datetime::sub() - subtracts an amount of days, months, years, hours, minutes and seconds from a datetime object










