wc_timezone_offset

Get timezone offset in seconds.

Description

(float) wc_timezone_offset(); 

Returns (float)


Usage

  1. if ( !function_exists( 'wc_timezone_offset' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_timezone_offset(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-formatting-functions.php  
  1. function wc_timezone_offset() { 
  2. if ( $timezone = get_option( 'timezone_string' ) ) { 
  3. $timezone_object = new DateTimeZone( $timezone ); 
  4. return $timezone_object->getOffset( new DateTime( 'now' ) ); 
  5. } else { 
  6. return floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS;