开发者

strtotime PHP function questions

I have a strtotime function that is doing something like this:

$var = strtotime('23:59:59' . $Date);

Where $Date is a date in this form开发者_如何学Pythonat: MM/DD/YY

However, this randomly fails and returns nothing from it.... am I doing something wrong here?

Thanks.


You should add a space character to the end of your time string


It's not necessarily always the best way to accomplish date math, but note the very handy feature that strtotime() takes interval words too:

$var = strtotime($date . ' +1 day -1 second');

I.e., start at $date, add one day, then subtract one second. This gives you 23:59:59 for $date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜