Time location

Hello everyone, I have problems to recover the correct time in the country.
Use this code:

$date=new DateTime(); //this returns the current date time
$result = $date->format(‘YmdHis’);

setlocale (LC_TIME, “it_IT”);
$data = strftime(’%Y%m%d-%h%M’);
echo $data;
$data1 = date(" - Y-m-d H:i:s");
echo $data1;

The time is always 4 hours behind.
What can I check?
Thanks.

The time is retrieved from your server. I guess that that time is not correct.

Check your php.ini for the default time zone or use date_default_timezone_set (see http://php.net/manual/en/function.date-default-timezone-set.php)