The date value does not contain a time, and the time value does not contain a date. UNIX timestamps however are compound values which are date-time values and must contain both. When you instantiate a new DateTime
object and you give it an incomplete timestamp (i.e. missing either date or time), it fills in the missing values from the current time. And that will of course always be different.
You'll have to instantiate the DateTime
object with both to get your UNIX timestamp. You cannot output a UNIX timestamp separately for date and time, because that doesn't make any sense. Your strtotime
code doesn't make any sense. You can separate the DateTime
object into date and time components again later if necessary, but not into two separate UNIX timestamps.
$event = DateTime::createFromFormat(
'd/m/Y H:i:s',
"$record[Date] $record[Time]",
new DateTimeZone(Config::get('app.timezone'))
);
echo $event->getTimestamp();
echo $event->format('Y-m-d');
echo $event->format('H:i:s');