You are currently executing strtotime('$date $time') . Variables enclosed in single quotation marks are not interpolated. If you use single quotes, PHP will treat it as a literal string, and strototime() will try to convert the string $date $time to a timestamp.
This will fail and it will explain why you are getting the wrong results.
Instead, you need to use double quotes:
$combinedDT = date('Ymd H:i:s', strtotime("$date $time")); ^ ^
Amal murali
source share