I need to display local time in city New Your for everyone user, who visit my web site. How I can do it?
1 Answer
Put this at the top of your php.
date_default_timezone_set("America/New_York");
You can also do this.
$date = new DateTime();
$date->setTimezone(new DateTimeZone('America/Detroit'));
$fdate = $date->format('Y-m-d H:i:s');`
$fdate
will print the appropriate time in new york with date.
All the timezones here - http://php.net/manual/en/timezones.america.php