日期格式PHP

I am trying to format a date as 2015-07-12 15:00 from the values declared in my variables

// unix
$date = 1436713200
// string
$time = '15:00';

to get a date format 2015-07-12 15:00 but failing, using this

$newdate = date('Y-m-d H:i:s', $date.' '.$time);

I get 'A non well formed numeric value encountered'. Can anyone help? I understand it is possibly due to the mix of string and unix but unsure how to get round this.

I would suggest you to use DateTime instance to avoid timezone issues:

$d = date_create('@1436713200'); // creates DateTime instance
$d->setTime(15, 00); // sets current time to desired hours, minutes
echo $d->format('Y-m-d H:i:s'); // prints it out with format specified
//⇒ 2015-07-12 15:00:00

Use this

$date =  date('Y-m-d','1436713200');
// string
$time = '15:00';

echo $newdate = date('Y-m-d H:i', strtotime($date.' '.$time));

You do not have to provie the $time variable. Unix time is a full date with time.

Use: $newdate = date('Y-m-d H:i:s', $date);