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.
精彩评论