$combinedDT = date('Y-m-d H:i:s', strtotime('$date $time'));
Date Format 2013-10-14
time format 23:40:19
i'm getting zeros when trying to store into a datetime datatype
You're currently doing strtotime('$date $time')
. Variables wrapped in single-quotes aren't interpolated. If you use single-quotes, PHP will treat it as a literal string, and strototime()
will try to convert the string $date $time
into a timestamp.
It'll fail and that would explain why you're getting incorrect results.
You need to use double quotes instead:
$combinedDT = date('Y-m-d H:i:s', strtotime("$date $time"));
^ ^