Am trying to convert time in unix format to php date time So i have tried the following
$timezone = "America/Guayaquil";
date_default_timezone_set($timezone);
var_dump(date("Y-m-d h:m:s", time()))
When i check the above it doesn't return the actual local time
Note that the value of time is a specific timestamp example
1528825868
How do i go on about this as it gives incorrect time
PHP version? (php -v)
Have you tried with:
ini_set( 'date.timezone', 'America/Guayaquil' );
You can check if the timezone is being correctly set by doing
<?php
date_default_timezone_set('America/Guayaquil');
$script_tz = date_default_timezone_get();
if (strcmp($script_tz, ini_get('date.timezone'))){
echo 'Script timezone differs from ini-set timezone.';
} else {
echo 'Script timezone and ini-set timezone match.';
}
?>
Source: http://php.net/manual/en/function.date-default-timezone-set.php