Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (ScopeResolverInterface $scopeResolver, ResolverInterface $localeResolver, \Magento\Framework\Stdlib\DateTime $dateTime, ScopeConfigInterface $scopeConfig, $scopeType, $defaultTimezonePath) | |
getDefaultTimezonePath () | |
getDefaultTimezone () | |
getConfigTimezone ($scopeType=null, $scopeCode=null) | |
getDateFormat ($type=\IntlDateFormatter::SHORT) | |
getDateFormatWithLongYear () | |
getTimeFormat ($type=\IntlDateFormatter::SHORT) | |
getDateTimeFormat ($type) | |
date ($date=null, $locale=null, $useTimezone=true, $includeTime=true) | |
scopeDate ($scope=null, $date=null, $includeTime=false) | |
formatDate ($date=null, $format=\IntlDateFormatter::SHORT, $showTime=false) | |
scopeTimeStamp ($scope=null) | |
isScopeDateInInterval ($scope, $dateFrom=null, $dateTo=null) | |
formatDateTime ( $date, $dateType=\IntlDateFormatter::SHORT, $timeType=\IntlDateFormatter::SHORT, $locale=null, $timezone=null, $pattern=null) | |
convertConfigTimeToUtc ($date, $format='Y-m-d H:i:s') | |
Protected Attributes | |
$_allowedFormats | |
$_scopeType | |
$_scopeResolver | |
$_dateTime | |
$_defaultTimezonePath | |
$_scopeConfig | |
$_localeResolver | |
Timezone library
@SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 21 of file Timezone.php.
__construct | ( | ScopeResolverInterface | $scopeResolver, |
ResolverInterface | $localeResolver, | ||
\Magento\Framework\Stdlib\DateTime | $dateTime, | ||
ScopeConfigInterface | $scopeConfig, | ||
$scopeType, | |||
$defaultTimezonePath | |||
) |
ScopeResolverInterface | $scopeResolver | |
ResolverInterface | $localeResolver | |
\Magento\Framework\Stdlib\DateTime | $dateTime | |
ScopeConfigInterface | $scopeConfig | |
string | $scopeType | |
string | $defaultTimezonePath |
Definition at line 71 of file Timezone.php.
convertConfigTimeToUtc | ( | $date, | |
$format = 'Y-m-d H:i:s' |
|||
) |
Convert date from config timezone to Utc. If pass \DateTime object as argument be sure that timezone is the same with config timezone
string | \DateTimeInterface | $date | |
string | $format |
LocalizedException |
Implements TimezoneInterface.
Definition at line 310 of file Timezone.php.
date | ( | $date = null , |
|
$locale = null , |
|||
$useTimezone = true , |
|||
$includeTime = true |
|||
) |
{Create \DateTime object for current locale
mixed | $date | |
string | $locale | |
bool | $useTimezone | |
bool | $includeTime |
Implements TimezoneInterface.
Definition at line 162 of file Timezone.php.
formatDate | ( | $date = null , |
|
$format = \IntlDateFormatter::SHORT , |
|||
$showTime = false |
|||
) |
{Format date using current locale options and time zone.
\DateTime | null | $date | |
int | $format | |
bool | $showTime |
Implements TimezoneInterface.
Definition at line 209 of file Timezone.php.
formatDateTime | ( | $date, | |
$dateType = \IntlDateFormatter::SHORT , |
|||
$timeType = \IntlDateFormatter::SHORT , |
|||
$locale = null , |
|||
$timezone = null , |
|||
$pattern = null |
|||
) |
string | \DateTimeInterface | $date | |
int | $dateType | |
int | $timeType | |
string | null | $locale | |
string | null | $timezone | |
string | null | $pattern |
Implements TimezoneInterface.
Definition at line 268 of file Timezone.php.
getConfigTimezone | ( | $scopeType = null , |
|
$scopeCode = null |
|||
) |
{Gets the scope config timezone
string | $scopeType | |
string | $scopeCode |
Implements TimezoneInterface.
Definition at line 106 of file Timezone.php.
getDateFormat | ( | $type = \IntlDateFormatter::SHORT | ) |
{Retrieve ISO date format
int | $type |
Implements TimezoneInterface.
Definition at line 118 of file Timezone.php.
getDateFormatWithLongYear | ( | ) |
{Retrieve short date format with 4-digit year
Implements TimezoneInterface.
Definition at line 130 of file Timezone.php.
getDateTimeFormat | ( | $type | ) |
{Retrieve ISO datetime format
string | $type |
Implements TimezoneInterface.
Definition at line 154 of file Timezone.php.
getDefaultTimezone | ( | ) |
{Retrieve timezone code
Implements TimezoneInterface.
Definition at line 98 of file Timezone.php.
getDefaultTimezonePath | ( | ) |
{Return path to default timezone
Implements TimezoneInterface.
Definition at line 90 of file Timezone.php.
getTimeFormat | ( | $type = \IntlDateFormatter::SHORT | ) |
{Retrieve ISO time format
string | $type |
Implements TimezoneInterface.
Definition at line 142 of file Timezone.php.
isScopeDateInInterval | ( | $scope, | |
$dateFrom = null , |
|||
$dateTo = null |
|||
) |
{Checks if current date of the given scope (in the scope timezone) is within the range
int | string | \Magento\Framework\App\ScopeInterface | $scope | |
string | null | $dateFrom | |
string | null | $dateTo |
Implements TimezoneInterface.
Definition at line 236 of file Timezone.php.
scopeDate | ( | $scope = null , |
|
$date = null , |
|||
$includeTime = false |
|||
) |
{Create \DateTime object with date converted to scope timezone and scope Locale
mixed | $scope | Information about scope |
string | integer | \DateTime | array | null | $date | date in UTC |
boolean | $includeTime | flag for including time to date |
Implements TimezoneInterface.
Definition at line 196 of file Timezone.php.
scopeTimeStamp | ( | $scope = null | ) |
{Get scope timestamp Timestamp will be built with scope timezone settings
mixed | $scope |
Implements TimezoneInterface.
Definition at line 223 of file Timezone.php.
|
protected |
Definition at line 26 of file Timezone.php.
|
protected |
Definition at line 46 of file Timezone.php.
|
protected |
Definition at line 51 of file Timezone.php.
|
protected |
Definition at line 61 of file Timezone.php.
|
protected |
Definition at line 56 of file Timezone.php.
|
protected |
Definition at line 41 of file Timezone.php.
|
protected |
Definition at line 36 of file Timezone.php.