Methods summary
public static
array
|
#
getTimeZones( )
Returns the list of available time zones with localized descriptions.
Returns the list of available time zones with localized descriptions.
Returns
array
|
public static
|
|
public static
string
|
#
getDefaultTimeZone( )
Returns the default time zone.
Returns the default time zone.
Returns
string
|
public static
string
|
#
date( string $format, integer|string|null $time = null, string|null $timezone = null, string|null $locale = null )
Returns date as string according to specified format.
Returns date as string according to specified format.
Parameters
- $format
string $format Date format. Format symbols acceptable for PHP function date are
supported. To display month name in lowercase, character 'f' should be used.
- $time
integer|string|null $time Unix timestamp. If not specified, current timestamp is used.
- $timezone
string|null $timezone Time zone identifier. If not specified, the time zone is determined
automatically.
- $locale
string|null $locale Locale identifier. If not specifed, current user's locale is determined
automatically.
Returns
string
|
protected static
|
|
public static
string
|
#
format( string $format, string|null $time = null, string|null $timezone = null, string|null $locale = null )
Returns time as string according to specified format.
Returns time as string according to specified format.
Parameters
- $format
string $format Date/time format. The following format strings are acceptable: -
'humandatetime': adds words "yesterday", "today", "tomorrow" instead of
appropriate dates relative to the current user date - 'humandate': returns the
date in format 'd f Y' supported by method date (format strings listed below are
also supported by that method) - 'date': returns date/time in format 'Y-m-d' -
'time': returns date/time in format 'H:i' - 'fulltime': returns date/time in
format 'H:i:s' - 'datetime': returns date/time in format 'Y-m-d H:i' -
'fulldatetime': returns date/time in format 'Y-m-d H:i:s' - 'timestamp': returns
date/time in format 'U'
- $time
string|null $time Unix timestamp. If not specified, current timestamp is used.
- $timezone
string|null $timezone Time zone identifier. If not specified, the time zone is determined
automatically.
- $locale
string|null $locale Locale identifier. If not specifed, current user's locale is determined
automatically.
Returns
string
See
|
public static
string
|
#
getFormat( string $format, string|null $locale = null )
Returns format strings for PHP function date corresponding to formats used by
Webasyst framework.
Returns format strings for PHP function date corresponding to formats used by
Webasyst framework.
Parameters
- $format
string $format Time format strings used in Webasyst framework including the following
options: - 'date_formats' sub-array keys specified in locale configuration file
located in wa-system/locale/data/, - PHP class DateTime constants, - format
strings acceptable for PHP function date, or one of the identifiers
corresponding to pre-defined time formatting strings supported by method
format().
- $locale
string|null $locale Locale identifier. If not specifed, current user locale is determined
automatically.
Returns
string
See
|
public static
|
#
getFormatJS( string $format, string|null $locale = null )
Returns format strings for date/time formatting by means of JavaScript code
corresponding to formats used by Webasyst framework.
Returns format strings for date/time formatting by means of JavaScript code
corresponding to formats used by Webasyst framework.
Parameters
- $format
string $format Format string accepted by parameter$format of method getFormat().
- $locale
string|null $locale Locale identifier. If not specifed, current user's locale is determined
automatically.
See
|
public static
string
|
#
parse( string $format, string $string, string|null $timezone = null, string|null $locale = null )
Returns time value, formatted using one of the formats supported by Webasyst
framework, as a string accepted by standard PHP functions.
Returns time value, formatted using one of the formats supported by Webasyst
framework, as a string accepted by standard PHP functions.
Parameters
- $format
string $format Format string accepted by format() method except for 'humandatetime'.
- $string
string $string Date/time value string formatted to match the format identifier
specified in $format parameter.
- $timezone
string|null $timezone Time zone identifier. If not specified, current time zone is
determined automatically.
- $locale
string|null $locale Locale identifier. If not specifed, current user locale is determined
automatically.
Returns
string
See
|