获取strtotime以在给定时间找到下一个时间戳

I'm trying to make strtotime give me a timestamp, but I only know that it's a hour and minute and it's the next in the row. Fx.

If the given hour and minute is 01:00 (AM) I require it to return the timestamp of 01:00 (AM), if it is the day before at 19:00, I would like it to return the timestamp of 01:00 the next day, but if it is after midnight at 00:30, it should return the timestamp 01:00 the same date.

To simplify it, it's the NEXT occurrence of a time.

Strtotime is giving me the time on the same day, if and not the next occurrence.

You can easily generate a timestamp, see if it's already past, and then increment the day.

Something like this perhaps?

$timestamp = strtotime("1:00 am");
if($timestamp < time()) {
    $timestamp = strtotime("+1 day",$timestamp);
}

Or if you want to tighten it up to a one-liner:

$string = "1:00 am";
$timestamp = (strtotime($string) > time()) ? strtotime($string) : strtotime("tomorrow " . $string);