source/Core/UtilsDate.php
public function convertDBTimestamp($oObject, $blToTimeStamp = false)
    {
        // on this case usually means that we gonna save value, and value is formatted, not plain
        $sSQLTimeStampPattern = "/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$/";
        $sISOTimeStampPattern = "/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/";
        $aMatches = [];
        $oStr = getStr();

        // preparing value to save
        if ($blToTimeStamp) {
            // reformatting value to ISO
            $this->convertDBDateTime($oObject, $blToTimeStamp);

            if ($oStr->preg_match($sISOTimeStampPattern, $oObject->value, $aMatches)) {
                // changing layout
                $oObject->setValue($aMatches[1] . $aMatches[2] . $aMatches[3] . $aMatches[4] . $aMatches[5] . $aMatches[6]);
                $oObject->fldmax_length = strlen($oObject->value);

                return $oObject->value;
            }
        } else {
            // loading and formatting value
            // checking and parsing SQL timestamp value
            //$sSQLTimeStampPattern = "/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$/";
            if ($oStr->preg_match($sSQLTimeStampPattern, $oObject->value, $aMatches)) {
                $iTimestamp = mktime(
                    $aMatches[4], //h
                    $aMatches[5], //m
                    $aMatches[6], //s
                    $aMatches[2], //M
                    $aMatches[3], //d
                    $aMatches[1]
                ); //y
                if (!$iTimestamp) {
                    $iTimestamp = "0";
                }

                $oObject->setValue(trim(date("Y-m-d H:i:s", $iTimestamp)));
                $oObject->fldmax_length = strlen($oObject->value);
                $this->convertDBDateTime($oObject, $blToTimeStamp);

                return $oObject->value;
            }
        }
    }
public function convertDBTimestamp($oObject, $blToTimeStamp = false)
    {
        // on this case usually means that we gonna save value, and value is formatted, not plain
        $sSQLTimeStampPattern = "/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$/";
        $sISOTimeStampPattern = "/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/";
        $aMatches = [];
        $oStr = getStr();

        // preparing value to save
        if ($blToTimeStamp) {
            // reformatting value to ISO
            $this->convertDBDateTime($oObject, $blToTimeStamp);

            if ($oStr->preg_match($sISOTimeStampPattern, $oObject->value, $aMatches)) {
                // changing layout
                $oObject->setValue($aMatches[1] . $aMatches[2] . $aMatches[3] . $aMatches[4] . $aMatches[5] . $aMatches[6]);
                $oObject->fldmax_length = strlen($oObject->value);

                return $oObject->value;
            }
        } else {
            // loading and formatting value
            // checking and parsing SQL timestamp value
            //$sSQLTimeStampPattern = "/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$/";
            if ($oStr->preg_match($sSQLTimeStampPattern, $oObject->value, $aMatches)) {
                $iTimestamp = mktime(
                    $aMatches[4], //h
                    $aMatches[5], //m
                    $aMatches[6], //s
                    $aMatches[2], //M
                    $aMatches[3], //d
                    $aMatches[1]
                ); //y
                if (!$iTimestamp) {
                    $iTimestamp = "0";
                }

                $oObject->setValue(trim(date("Y-m-d H:i:s", $iTimestamp)));
                $oObject->fldmax_length = strlen($oObject->value);
                $this->convertDBDateTime($oObject, $blToTimeStamp);

                return $oObject->value;
            }
        }
    }
public function convertDBTimestamp ( $ oObject , $ blToTimeStamp = false ) { // on this case usually means that we gonna save value, and value is formatted, not plain $ sSQLTimeStampPattern = "/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$/" ; $ sISOTimeStampPattern = "/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/" ; $ aMatches = [ ] ; $ oStr = getStr ( ) ; // preparing value to save if ( $ blToTimeStamp ) { // reformatting value to ISO $ this -> convertDBDateTime ( $ oObject , $ blToTimeStamp ) ; if ( $ oStr -> preg_match ( $ sISOTimeStampPattern , $ oObject -> value , $ aMatches ) ) { // changing layout $ oObject -> setValue ( $ aMatches [ 1 ] . $ aMatches [ 2 ] . $ aMatches [ 3 ] . $ aMatches [ 4 ] . $ aMatches [ 5 ] . $ aMatches [ 6 ] ) ; $ oObject -> fldmax_length = strlen ( $ oObject -> value ) ; return $ oObject -> value ; } } else { // loading and formatting value // checking and parsing SQL timestamp value //$sSQLTimeStampPattern = "/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$/"; if ( $ oStr -> preg_match ( $ sSQLTimeStampPattern , $ oObject -> value , $ aMatches ) ) { $ iTimestamp = mktime ( $ aMatches [ 4 ] , //h $ aMatches [ 5 ] , //m $ aMatches [ 6 ] , //s $ aMatches [ 2 ] , //M $ aMatches [ 3 ] , //d $ aMatches [ 1 ] ) ; //y if ( ! $ iTimestamp ) { $ iTimestamp = "0" ; } $ oObject -> setValue ( trim ( date ( "Y-m-d H:i:s" , $ iTimestamp ) ) ) ; $ oObject -> fldmax_length = strlen ( $ oObject -> value ) ; $ this -> convertDBDateTime ( $ oObject , $ blToTimeStamp ) ; return $ oObject -> value ; } } }
Bidirectional converter for timestamp field

@param object $oObject       oxField type object that keeps db field info
@param bool   $blToTimeStamp if true - converts value to database compatible timestamp value

@return string
Bidirectional converter for timestamp field