"; function time_translate($tz_from, $tz_to, $time_str = 'now', $format = 'Y-m-d g:i:s a') { $dt = new DateTime($time_str, new DateTimezone($tz_from)); $dt->setTimezone(new DateTimezone($tz_to)); return $dt->format($format); } $time_diffs = array('now'); foreach ($time_diffs as $diff) { echo "{$diff}:" . "
" . "Current Time: " . date("Y-m-d g:i:s a", strtotime($diff)) . "
" . "UTC: " . time_translate("US/Eastern", "UTC", $diff) . "
" . "PST: " . time_translate("US/Eastern", "PST", $diff) . "
" . "PDT: " . time_translate("US/Eastern", "PDT", $diff) . "
" . "EST: " . time_translate("US/Eastern", "EST", $diff) . "
" . "EDT: " . time_translate("US/Eastern", "EDT", $diff); } ?>
getOffset($pLocalDate); // Return the current date/time for the target timezone return date($szTimeFormat, strtotime($iOffset . ' seconds')); } //$szDateTime = get_timezone_time('jS M Y, H:i:s', TIMEZONE_CST) . ' selected timezone'; $szDateTime = get_timezone_time('H:i a', TIMEZONE_CST) . ' CST timezone'; echo $szDateTime ? $szDateTime : 'Invalid timezone'; ?>
$dtz = new DateTimeZone('America/Los_Angeles'); $time_in_sofia = new DateTime('now', $dtz); $offset = $dtz->getOffset( $time_in_sofia ) / 3600; echo "GMT" . ($offset < 0 ? $offset : "+".$offset) . "
"; foreach (DateTimeZone::listIdentifiers() as $timezone) { $time = new DateTime('now', new DateTimeZone($timezone)); //echo $timezone . ': ' . $time->format('c').'
'; echo $time->format('e P T').'
'; } ?>
"; echo date("D M d, Y G:i:s a"); $today = date("H:i a"); echo "
" . $today; ?> "; $timezone_offsets = array(); foreach(timezone_identifiers_list() as $timezone_identifier) { $date_time_zone = new DateTimeZone($timezone_identifier); $date_time = new DateTime('now', $date_time_zone); $timezone_offsets[$timezone_identifier] = $date_time_zone->getOffset($date_time); } print_r($timezone_offsets); echo "
"; print gmdate("Y-m-d\TH:i:s\Z"); ?>
Categories: Time