Welcome Guest, Not a member yet? Register   Sign In
Get my local time
#1

[eluser]cyberjunkie[/eluser]
I'm simply trying to display my local time in Miami using the following code:

Code:
date_default_timezone_set('America/New_York'); //is added in library
$timestamp = time();
$timezone = 'UM5'; //(UTC - 5:00) Eastern Time, Bogota, Lima, Quito
$daylight_saving = TRUE;
$miamitime = gmt_to_local($timestamp, $timezone, $daylight_saving);

echo unix_to_human($miamitime); // U.S. time, no seconds

The time I'm getting is 1 day ahead and 1 hour behind the actual local time. I'm testing the site on local server using WAMP. It looks to me like I'm setting everything right.. I'm not sure what is causing this. Please advise how to correctly display my local time.
#2

[eluser]rthut[/eluser]
Try:
Code:
date_default_timezone_set('America/New_York');
echo date('Y-m-d h:i:s',time());
#3

[eluser]Learn CodeIgniter[/eluser]
application/config/config.php
Try setting this
Code:
$config['time_reference'] = 'gmt';  // instead of 'local'




Theme © iAndrew 2016 - Forum software by © MyBB