\ActionScheduler_TimezoneHelper

Class ActionScheduler_TimezoneHelper

Summary

Methods
Properties
Constants
set_local_timezone()
get_local_timezone()
No public properties found
No constants found
get_local_timezone_string()
get_local_timezone_offset()
No protected properties found
N/A
No private methods found
$local_timezone
N/A

Properties

$local_timezone

$local_timezone : null|\DateTimeZone

DateTimeZone object.

Type

normal

Methods

set_local_timezone()

set_local_timezone(\DateTime  $date) : \ActionScheduler_DateTime

Set a DateTime's timezone to the WordPress site's timezone, or a UTC offset if no timezone string is available.

Parameters

\DateTime $date

Timestamp.

Returns

\ActionScheduler_DateTime

get_local_timezone()

get_local_timezone(bool  $reset = false) : mixed

Get local timezone.

Parameters

bool $reset

Toggle to discard stored value.

Returns

mixed

get_local_timezone_string()

get_local_timezone_string(bool  $reset = false) : string

Helper to retrieve the timezone string for a site until a WP core method exists (see https://core.trac.wordpress.org/ticket/24730).

Adapted from wc_timezone_string() and https://secure.php.net/manual/en/function.timezone-name-from-abbr.php#89155.

If no timezone string is set, and its not possible to match the UTC offset set for the site to a timezone string, then an empty string will be returned, and the UTC offset should be used to set a DateTime's timezone.

Parameters

bool $reset

Unused.

Returns

string —

PHP timezone string for the site or empty if no timezone string is available.

get_local_timezone_offset()

get_local_timezone_offset() : float

Get timezone offset in seconds.

Returns

float