API / Minn\Runtime / SiteTime

SiteTime final class

Minn\Runtime\SiteTime · public/minn/src/Minn/Runtime/SiteTime.php · 90 lines

Time as the site keeps it: its timezone (the named one, else the UTC offset), now in that zone or in UTC, a moment written in the site's language, and a stored date read back in a format.

Public

staticzoneName(): string#

The site's timezone as text (wp_timezone_string): its name, else its offset as +HH:MM.

staticzone(): DateTimeZone#

The site's timezone (wp_timezone).

staticnow(mixed $type, mixed $gmt = false): mixed#

Now (current_time): a timestamp for "timestamp" or "U" (the site's offset added unless in UTC), a database date for "mysql", else the format given, in the site's zone or UTC.

statictoGmt(mixed $date, mixed $format = 'Y-m-d H:i:s'): string#

A date in the site's zone written in UTC (get_gmt_from_date); the epoch for one that is not a date.

staticfromGmt(mixed $date, mixed $format = 'Y-m-d H:i:s'): string#

A date in UTC written in the site's zone (get_date_from_gmt); the epoch for one that is not a date.

staticformat(mixed $format, mixed $timestamp = NULL, mixed $timezone = NULL): mixed#

A moment written in a format, its names in the site's language (wp_date), as the filter leaves it.

staticfromStored(mixed $format, mixed $date, mixed $translate = true): mixed#

A stored date in a format (mysql2date): false for none or one that is not a date; "G" and "U" are timestamps (G with the site's offset); the names translated unless asked not to be.