How can I just change the timezone offset using Zend_Date?

I use Zend_Date to manage dates / times in a scheduling application.

The only way I can define a custom timezone is to use Javascript, which only gives the timezone offset. It seems that Zend_Date uses Timezones in the format "America / New_York".

Is there a way to get the time zone of users in this format or set the time zone offset using Zend_Date?

Thank!

+3
source share
3 answers

Nikki

Zend_Date, PHP- DateTime DateTimeZone ; , , Zend_Date.

.

, . , , .

+2

javascript cookie .

php , offset

$timezones = array (

    '-1' => 'adfas/adsfafsd',
    '-2' => 'adsfasdf/asdfasdf'
    ...
);

$date->setTimezone( $timezones[$_COOKIE['tz_offset']] );
0

timezone_name_from_abbr:

$javascript_offset = '-1';
$zone = timezone_name_from_abbr('', $javascript_offset * 3600, 0);

DST. .

0
source

Source: https://habr.com/ru/post/1744583/


All Articles