Attention! - Geeks' stuff ahead! ;)
With TimeZoneCalculator 1.00 and higher you can also realize a html select which displays for example the airtime of your internet radio station or your broadcasts in your users' local time. Another possibility for the usage of the upcoming function is the integration of date, time and timezone information into your travelling blog.
function getTimeZonesTime (
$time_string='',
$timezone_string='UTC',
$alt_style=false,
$alt_before_list='<ul>',
$alt_after_list='</ul>',
$alt_before_tag='<li>',
$alt_after_tag='</li>',
$alt_timeformat='Y-m-d H:i',
$alt_timezones=array(),
$display_name=true,
$use_container=true
)
$time_string: any unix timestamp (where -1262304000 <= $time_string <= 2145916800) or any English textual datetime description in the range of 1930-01-01 and 2038-01-01 which can be parsed with php's strtotime function; default is set to current UTC (which can also be automatically updated if activated in the Admin Menu)
$timezone_string: you can choose a php timezone_string; otherwise UTC will be used
$alt_style: default is set to false; can be changed to true, if you want to use the following five alternative style attributes instead of the ones from the WordPress database:
$alt_before_list: default <ul>
$alt_after_list: default </ul>
$alt_before_tag: default <li>
$alt_after_tag: default </li>
$alt_timeformat: default 'Y-m-d H:i'
$alt_timezones: alternative timezones-array - each array entry has to be a string as described in the Content Section of the Admin Menu; default is the timezones-entries array which can be modified in the Admin Menu
$display_name: if you want to display only the abbreviation (either from the database or manually entered) without tooltiptext, set this to false; default setting is true
$use_container: if set to true (default value) and $time_string has not been set (which means that the current UTC timestamp is used) TimeZoneCalculator wraps the output in a html div with the class timezonecalculator-refreshable-output - the class timezonecalculator-output will be used for all other output; if you set $use_container to false, no container div will be generated
Example for including a world-clock in your post-template (usually single.php or post.php in wp-content/themes) using WordPress the_date() function:
Find something similar to
the_date();
or
the_time();
and replace it with
<?php getTimeZonesTime(the_date('U', '', '', false)); ?>
This should output your selected timezones, whereas calculations are based on the timestamp of your post instead of using the current UTC.




