Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
TimezoneInterface Interface Reference
Inheritance diagram for TimezoneInterface:
Timezone

Public Member Functions

 getDefaultTimezonePath ()
 
 getDefaultTimezone ()
 
 getDateFormat ($type=\IntlDateFormatter::SHORT)
 
 getDateFormatWithLongYear ()
 
 getTimeFormat ($type=null)
 
 getDateTimeFormat ($type)
 
 date ($date=null, $locale=null, $useTimezone=true, $includeTime=true)
 
 scopeDate ($scope=null, $date=null, $includeTime=false)
 
 scopeTimeStamp ($scope=null)
 
 formatDate ( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false)
 
 getConfigTimezone ($scopeType=null, $scopeCode=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')
 

Detailed Description

Timezone Interface @api

Since
100.0.2

Definition at line 14 of file TimezoneInterface.php.

Member Function Documentation

◆ convertConfigTimeToUtc()

convertConfigTimeToUtc (   $date,
  $format = 'Y-m-d H:i:s' 
)
Parameters
string | \DateTimeInterface$date
string$format
Returns
string
Since
100.1.0

Implemented in Timezone.

◆ date()

date (   $date = null,
  $locale = null,
  $useTimezone = true,
  $includeTime = true 
)

Create \DateTime object for current locale

Parameters
mixed$date
string$locale
bool$useTimezone
bool$includeTime
Returns
\DateTime

Implemented in Timezone.

◆ formatDate()

formatDate (   $date = null,
  $format = \IntlDateFormatter::SHORT,
  $showTime = false 
)

Format date using current locale options and time zone.

Parameters
\DateTime | null$date
int$format
bool$showTime
Returns
string

Implemented in Timezone.

◆ formatDateTime()

formatDateTime (   $date,
  $dateType = \IntlDateFormatter::SHORT,
  $timeType = \IntlDateFormatter::SHORT,
  $locale = null,
  $timezone = null,
  $pattern = null 
)
Parameters
string | \DateTimeInterface$date
int$dateType
int$timeType
string | null$locale
string | null$timezone
string | null$pattern
Returns
string

Implemented in Timezone.

◆ getConfigTimezone()

getConfigTimezone (   $scopeType = null,
  $scopeCode = null 
)

Gets the scope config timezone

Parameters
string$scopeType
string$scopeCode
Returns
string

Implemented in Timezone.

◆ getDateFormat()

getDateFormat (   $type = \IntlDateFormatter::SHORT)

Retrieve ISO date format

Parameters
int$type
Returns
string

Implemented in Timezone.

◆ getDateFormatWithLongYear()

getDateFormatWithLongYear ( )

Retrieve short date format with 4-digit year

Returns
string

Implemented in Timezone.

◆ getDateTimeFormat()

getDateTimeFormat (   $type)

Retrieve ISO datetime format

Parameters
string$type
Returns
string

Implemented in Timezone.

◆ getDefaultTimezone()

getDefaultTimezone ( )

Retrieve timezone code

Returns
string

Implemented in Timezone.

◆ getDefaultTimezonePath()

getDefaultTimezonePath ( )

Return path to default timezone

Returns
string

Implemented in Timezone.

◆ getTimeFormat()

getTimeFormat (   $type = null)

Retrieve ISO time format

Parameters
string$type
Returns
string

Implemented in Timezone.

◆ isScopeDateInInterval()

isScopeDateInInterval (   $scope,
  $dateFrom = null,
  $dateTo = null 
)

Checks if current date of the given scope (in the scope timezone) is within the range

Parameters
int | string | \Magento\Framework\App\ScopeInterface$scope
string | null$dateFrom
string | null$dateTo
Returns
bool

Implemented in Timezone.

◆ scopeDate()

scopeDate (   $scope = null,
  $date = null,
  $includeTime = false 
)

Create \DateTime object with date converted to scope timezone and scope Locale

Parameters
mixed$scopeInformation about scope
string | integer | \DateTime | array | null$datedate in UTC
boolean$includeTimeflag for including time to date
Returns
\DateTime

Implemented in Timezone.

◆ scopeTimeStamp()

scopeTimeStamp (   $scope = null)

Get scope timestamp Timestamp will be built with scope timezone settings

Parameters
mixed$scope
Returns
int

Implemented in Timezone.


The documentation for this interface was generated from the following file: