If you choose a city as a timezone it will save to the "timezone_string" option but if you choose a Manual Offset (UTC+1 for instance) it is saved to the "gmt_offset" option
if you need the gmt_offset then
<?php echo get_option('gmt_offset'); ?>
this will give you an integer like 2 or -2.
and if you need the timezone string use
<?php echo get_option('timezone_string'); ?>
this will give you a string like America/Indianapolis
But i the php code like this
$tzs = get_option('gmt_offset'); $tzobj = timezone_open($tzs); $now = date_create('now',$tzobj );
this will give me what day is today
when when theme is activated the wordpress defaults to UTC+0 because of which the $tzs will throw warning like
timezone_open(): Unknown or bad timezone (0)
What i am trying to get is current day ..i.e Monday Tuesday like that. It worked fine for me if i am setting America/Indianapolis - a string.
The discussion on this was done here -> Wordpress returns a wrong date
How can i fix this? Can i make it work on both way?