ActionScheduler_TimezoneHelper
Located in classes/abstracts/ActionScheduler_TimezoneHelper.php.
Helper utilities for normalizing Action Scheduler DateTime objects to the site’s timezone or UTC offset.
Public Methods
set_local_timezone( DateTime $date )
Set a DateTime to the WordPress site timezone (timezone string preferred; otherwise uses a fixed UTC offset).
- Parameters:
$date(DateTime) - Returns:
ActionScheduler_DateTime
Notes:
- Accepts any
DateTime; if it is not anActionScheduler_DateTime, it is converted viaas_get_datetime_object().
get_local_timezone( $reset = false )
Deprecated helper returning a cached DateTimeZone instance.
- Parameters:
$reset(bool) clear cached value. - Returns:
DateTimeZone - Deprecated:
2.1.0(useActionScheduler_TimezoneHelper::set_local_timezone())
Protected Helpers
These are internal helpers but are listed here for reference because they are part of the class API surface:
get_local_timezone_string( $reset = false )
Return the site’s timezone string if available, or attempt to derive it from UTC offset.
- Parameters:
$reset(bool) unused. - Returns:
string
get_local_timezone_offset()
Return the site’s UTC offset in seconds.
- Returns:
float