To prevent misunderstandings: All my code lines where fine, and they work correctly. I just had a wrong parameter in my date()
, where I displayed the seconds date('H:s')
, where it should've displayed the minutes as date('H:i')
. (Thanks to chumkiu for the hint.)
I want to fetch the timestamp for the upcoming day at 00h10.
I thought I could use the strtotime()
function, e.g. like
$timestamp = strtotime('tomorrow 00:10');
But when I check
$mydate = date('Y-m-d H:s', $timestamp);
var_dump($mydate);
the output is
string(16) "2013-10-03 00:00"
The documentation of strtotime()
has a lot of examples how to get different times
echo strtotime("now"), "\n";
echo strtotime("10 September 2000"), "\n";
echo strtotime("+1 day"), "\n";
echo strtotime("+1 week"), "\n";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";
But none of them comes close to my problem.
Funny enough: I can do this
$time_h = strtotime('tomorrow +10 hours');
$time_m = strtotime('tomorrow +10 minutes');
whereas $time_h
returns the wanted result (10:00
), but $time_m
does not.
Any ideas?
just add 10 minutes:
$timestamp = strtotime('tomorrow +10min');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With