OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Core\UtilsDate Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Core\UtilsDate:
+ Collaboration diagram for OxidEsales\EshopCommunity\Core\UtilsDate:

Public Member Functions

 formatDBDate ($sDBDateIn, $blForceEnglishRet=false)
 
 convertDBDateTime ($oObject, $blToTimeStamp=false, $blOnlyDate=false)
 
 convertDBTimestamp ($oObject, $blToTimeStamp=false)
 
 convertDBDate ($oObject, $blToTimeStamp=false)
 
 getTime ()
 
 getRequestTime ()
 
 formatDBTimestamp ($iTimestamp)
 
 getRoundedRequestDateDBFormatted ($roundTo)
 
 getRequestTimeDBFormated ()
 
 formTime ($sTime='now', $sTime2=null)
 
 shiftServerTime ($iTime)
 
 getWeekNumber ($iFirstWeekDay, $sTimestamp=null, $sFormat=null)
 
 german2English ($sDate)
 
 isEmptyDate ($sDate)
 

Protected Member Functions

 _setDefaultFormatedValue ($oObject, $sDate, $sLocalDateFormat, $sLocalTimeFormat, $blOnlyDate)
 
 _defineAndCheckDefaultTimeValues ($blToTimeStamp)
 
 _defineAndCheckDefaultDateValues ($blToTimeStamp)
 
 _defaultDatePattern ()
 
 _defaultTimePattern ()
 
 _regexp2ValidateDateInput ()
 
 _regexp2ValidateTimeInput ()
 
 _defineDateFormattingRules ()
 
 _defineTimeFormattingRules ()
 
 _setDefaultDateTimeValue ($oObject, $sLocalDateFormat, $sLocalTimeFormat, $blOnlyDate)
 
 _setDate ($oObject, $sDateFormat, $aDFields, $aDateMatches)
 
 _formatCorrectTimeValue ($oObject, $sDateFormat, $sTimeFormat, $aDateMatches, $aTimeMatches, $aTFields, $aDFields)
 
 _processDate ($aTime, $aDate, $blGerman, $sFormat)
 

Detailed Description

Date manipulation utility class

Member Function Documentation

◆ _defaultDatePattern()

OxidEsales\EshopCommunity\Core\UtilsDate::_defaultDatePattern ( )
protected

sets default date pattern

Returns
array

◆ _defaultTimePattern()

OxidEsales\EshopCommunity\Core\UtilsDate::_defaultTimePattern ( )
protected

sets default time pattern

Returns
array

◆ _defineAndCheckDefaultDateValues()

OxidEsales\EshopCommunity\Core\UtilsDate::_defineAndCheckDefaultDateValues (   $blToTimeStamp)
protected

defines and checks default date values

Parameters
bool$blToTimeStampmarker how to format
Returns
string

◆ _defineAndCheckDefaultTimeValues()

OxidEsales\EshopCommunity\Core\UtilsDate::_defineAndCheckDefaultTimeValues (   $blToTimeStamp)
protected

defines and checks default time values

Parameters
bool$blToTimeStamp-
Returns
string

◆ _defineDateFormattingRules()

OxidEsales\EshopCommunity\Core\UtilsDate::_defineDateFormattingRules ( )
protected

define date formatting rules

Returns
array

◆ _defineTimeFormattingRules()

OxidEsales\EshopCommunity\Core\UtilsDate::_defineTimeFormattingRules ( )
protected

defines time formatting rules

Returns
array

◆ _formatCorrectTimeValue()

OxidEsales\EshopCommunity\Core\UtilsDate::_formatCorrectTimeValue (   $oObject,
  $sDateFormat,
  $sTimeFormat,
  $aDateMatches,
  $aTimeMatches,
  $aTFields,
  $aDFields 
)
protected

Formatting correct time value

Parameters
object$oObjectdata field object
string$sDateFormatdate format
string$sTimeFormattime format
array$aDateMatchesnew new date
array$aTimeMatchesnew time
array$aTFieldsdefines the time fields
array$aDFieldsdefines the date fields

◆ _processDate()

OxidEsales\EshopCommunity\Core\UtilsDate::_processDate (   $aTime,
  $aDate,
  $blGerman,
  $sFormat 
)
protected

Processes amd formats date / time.

Parameters
string$aTimesplitted time ( array( H, m, s ) )
array$aDatesplitted date ( array( Y, m, d ) )
bool$blGermantrue if incoming string is in German format (dotted)
string$sFormatdate format to produce
Returns
string formatted string

◆ _regexp2ValidateDateInput()

OxidEsales\EshopCommunity\Core\UtilsDate::_regexp2ValidateDateInput ( )
protected

regular expressions to validate date input

Returns
array

◆ _regexp2ValidateTimeInput()

OxidEsales\EshopCommunity\Core\UtilsDate::_regexp2ValidateTimeInput ( )
protected

regular expressions to validate time input

Returns
array

◆ _setDate()

OxidEsales\EshopCommunity\Core\UtilsDate::_setDate (   $oObject,
  $sDateFormat,
  $aDFields,
  $aDateMatches 
)
protected

sets date

Parameters
object$oObjectdate field object
string$sDateFormatdate format
array$aDFieldsdays
array$aDateMatchesnew date as array (month, year)

◆ _setDefaultDateTimeValue()

OxidEsales\EshopCommunity\Core\UtilsDate::_setDefaultDateTimeValue (   $oObject,
  $sLocalDateFormat,
  $sLocalTimeFormat,
  $blOnlyDate 
)
protected

Sets default date time value

Parameters
object$oObjectdate field object
string$sLocalDateFormatinput format
string$sLocalTimeFormatlocal format
bool$blOnlyDatemarker to format only date field (no time)

◆ _setDefaultFormatedValue()

OxidEsales\EshopCommunity\Core\UtilsDate::_setDefaultFormatedValue (   $oObject,
  $sDate,
  $sLocalDateFormat,
  $sLocalTimeFormat,
  $blOnlyDate 
)
protected

sets default formatted value

Parameters
object$oObjectdate field object
string$sDatepreferred date
string$sLocalDateFormatinput format
string$sLocalTimeFormatlocal format
bool$blOnlyDatemarker to format only date field (no time)
Returns
null

◆ convertDBDate()

OxidEsales\EshopCommunity\Core\UtilsDate::convertDBDate (   $oObject,
  $blToTimeStamp = false 
)

Bidirectional converter for date field

Parameters
object$oObjectoxField type object that keeps db field info
bool$blToTimeStampif true - converts value to database compatible timestamp value
Returns
string

◆ convertDBDateTime()

OxidEsales\EshopCommunity\Core\UtilsDate::convertDBDateTime (   $oObject,
  $blToTimeStamp = false,
  $blOnlyDate = false 
)

Bidirectional converter for date/datetime field

Parameters
object$oObjectdata field object
bool$blToTimeStampset TRUE to format MySQL compatible value
bool$blOnlyDateset TRUE to format "date" type field
Returns
string

◆ convertDBTimestamp()

OxidEsales\EshopCommunity\Core\UtilsDate::convertDBTimestamp (   $oObject,
  $blToTimeStamp = false 
)

Bidirectional converter for timestamp field

Parameters
object$oObjectoxField type object that keeps db field info
bool$blToTimeStampif true - converts value to database compatible timestamp value
Returns
string

◆ formatDBDate()

OxidEsales\EshopCommunity\Core\UtilsDate::formatDBDate (   $sDBDateIn,
  $blForceEnglishRet = false 
)

Format date to user defined format.

Parameters
string$sDBDateInDate to reformat
bool$blForceEnglishRetForce to return primary value(default false)
Returns
string

◆ formatDBTimestamp()

OxidEsales\EshopCommunity\Core\UtilsDate::formatDBTimestamp (   $iTimestamp)

Returns the the timestamp formatted as date string for the database

Parameters
int$iTimestampthe timestamp to be formatted
Returns
bool|string timestamp formatted as date string for the database, false on error

◆ formTime()

OxidEsales\EshopCommunity\Core\UtilsDate::formTime (   $sTime = 'now',
  $sTime2 = null 
)

Form time

Parameters
string$sTimetime to create timestamp.
string$sTime2hours, minutes and seconds to update created timestamp.
Returns
int formed (modified according timezone) time

◆ german2English()

OxidEsales\EshopCommunity\Core\UtilsDate::german2English (   $sDate)

Reformats and returns German date string to English.

Parameters
string$sDateGerman format date string
Returns
string

◆ getRequestTime()

OxidEsales\EshopCommunity\Core\UtilsDate::getRequestTime ( )

Returns time wen the request was started according shop timezone configuration. Configures in Admin -> Main menu -> Core Settings -> General REQUEST TIME is faster because it is not an syscall like time

Returns
int current (modified according timezone) time

◆ getRequestTimeDBFormated()

OxidEsales\EshopCommunity\Core\UtilsDate::getRequestTimeDBFormated ( )

Returns the the request time formatted as date string for the database

Returns
bool|string

◆ getRoundedRequestDateDBFormatted()

OxidEsales\EshopCommunity\Core\UtilsDate::getRoundedRequestDateDBFormatted (   $roundTo)

Returns the the timestamp formatted as date string for the database

Parameters
int$roundToa amount of seconds to be rounded to e.g. 300 for rounding to 5 minutes
Returns
bool|string the data string formatted for the database (SQL), false on error

◆ getTime()

OxidEsales\EshopCommunity\Core\UtilsDate::getTime ( )

Returns time according shop timezone configuration. Configures in Admin -> Main menu -> Core Settings -> General

See also
getRequestTime
Returns
int current (modified according timezone) time

◆ getWeekNumber()

OxidEsales\EshopCommunity\Core\UtilsDate::getWeekNumber (   $iFirstWeekDay,
  $sTimestamp = null,
  $sFormat = null 
)

Returns number of the week according to numeration standards (configurable in admin): U - week number, starting with the first Sunday as the first day of the first week; W - week number, starting with the first Monday as the first day of the first week.

Parameters
int$iFirstWeekDayif set formats with U, otherwise with W ($myConfig->getConfigParam( 'iFirstWeekDay' ))
string$sTimestamptimestamp, default is null (returns current week number);
string$sFormatcalculation format ( "%U" or "%w"), default is null (returns "%W" or defined in admin ).
Returns
int

◆ isEmptyDate()

OxidEsales\EshopCommunity\Core\UtilsDate::isEmptyDate (   $sDate)

Checks if date string is empty date field. Empty string or string with all date values equal to 0 is treated as empty.

Parameters
array$sDatedate or date time string
Returns
bool

◆ shiftServerTime()

OxidEsales\EshopCommunity\Core\UtilsDate::shiftServerTime (   $iTime)

Shift time if needed by configured timezone.

Parameters
int$iTime
Returns
int

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