Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对这些 strtotime 函数的结果有点困惑,我希望它们相同但得到完全不同的结果:
echo strtotime(date('Y-m-d h:i:s',time()).' +1 hour')."\n"; echo strtotime('now +1 hour')."\n";
结果是:
date('Y-m-d h:i:s',time(): 1340117163 now +1 hour: 1340160363
难道我做错了什么?
问题在于传递给 date() 的字符串格式中的“h”;我玩了一堆,发现相差 12 小时,这是一个完美的嫌疑人。
大写 H(明确的小时数),你应该很好。:-)