WooCommerce Code Reference

TimeUtil
in package

Class with date and time utilities.

Table of Contents

$utc_date_time_zone  : DateTimeZone
Instance of a DateTimeZone object representing UTC.
__construct()  : mixed
Class constructor.
get_utc_date_time_zone()  : DateTimeZone
Get the instance of the DateTimeZone object representing UTC.
is_valid_date()  : bool
Check if a string represents a valid date in a given format.

Properties

$utc_date_time_zone

Instance of a DateTimeZone object representing UTC.

private static DateTimeZone $utc_date_time_zone

Methods

get_utc_date_time_zone()

Get the instance of the DateTimeZone object representing UTC.

public static get_utc_date_time_zone() : DateTimeZone
Return values
DateTimeZoneDateTimeZone object representing UTC.

is_valid_date()

Check if a string represents a valid date in a given format.

public static is_valid_date(string $date[, string $format = 'Y-m-d H:i:s' ]) : bool
Parameters
$date : string

The date string to check.

$format : string = 'Y-m-d H:i:s'

The format to verify the date string against.

Return values
boolTrue if $date represents a valid date/time according to $format, false otherwise.