Zend_Date example

$result = Shopware()->Container()->get('events')->filter(
            'Shopware_Modules_Export_ExportResult_Filter',
            $result,
            ['feedId' => $this->sFeedID, 'subject' => $this]
        );

        // Update db with the latest values         $count = (int) $result->rowCount();
        $this->db->update(
            's_export',
            [
                'last_export' => new Zend_Date(),
                'cache_refreshed' => new Zend_Date(),
                'count_articles' => $count,
            ],
            ['id = ?' => $this->sFeedID]
        );

        // Fetches all required data to smarty         $rows = [];
        for ($rowIndex = 1; $row = $result->fetch(); ++$rowIndex) {
            if (!empty($row['group_ordernumber_2'])) {
                $row['group_ordernumber'] = $this->_decode_line($row['group_ordernumber_2']);
                
'sViewport' => 'newsletter',
                    'action' => 'index',
                    'sConfirmation' => $hash,
                    'module' => 'frontend',
                ]);

                $this->sendMail($email, 'sOPTINNEWSLETTER', $link);

                $this->db->insert(
                    's_core_optin',
                    [
                        'datum' => new Zend_Date(),
                        'hash' => $hash,
                        'data' => $data,
                        'type' => 'swNewsletter',
                    ]
                );

                return true;
            }

            $groupID = $this->config->get('sNEWSLETTERDEFAULTGROUP');
            if (!$groupID) {
                


    /** @var Zend_Locale $locale */
    $locale = Shopware()->Container()->get('locale');
    if (\is_string($value)) {
        $value = strtotime($value);
    } elseif ($value instanceof DateTime) {
        /** @var \DateTime $value */
        $value = $value->getTimestamp();
    }

    $date = new Zend_Date($value, Zend_Date::TIMESTAMP, $locale);

    $value = $date->toString($format$type);

    $value = htmlentities($value, ENT_COMPAT, 'UTF-8', false);

    return $value;
}
switch (strtolower($k))    {
                    case 'expires':
                        if(($expires = strtotime($v)) === false) {
                            /** * The expiration is past Tue, 19 Jan 2038 03:14:07 UTC * the maximum for 32-bit signed integer. Zend_Date * can get around that limit. * * @see Zend_Date */

                            $expireDate = new Zend_Date($v);
                            $expires = $expireDate->getTimestamp();
                        }
                        break;

                    case 'path':
                        $path = $v;
                        break;

                    case 'domain':
                        $domain = $v;
                        break;

                    
/** * Sets the next date when the cronjob is due * * @param string|\Zend_Date $next * * @return Enlight_Components_Cron_Job */
    public function setNext($next = null)
    {
        if (!$next instanceof Zend_Date) {
            $next = new Zend_Date($next, \is_string($next) ? Zend_Date::ISO_8601 : null);
        }
        $this->next = $next;

        return $this;
    }

    /** * Returns a Zend_Date object which contains the date on which the job last run * * @return Zend_Date */
    


        $where = [];
        $updateData = [];
        $insertData = [];

        if ($this->_namespaceColumn !== null) {
            $insertData[$this->_namespaceColumn] = $name;
            $where[] = $db->quoteInto($this->_namespaceColumn . '=?', $name);
        }
        if ($this->_updatedColumn !== null) {
            $updateData[$this->_updatedColumn] = new Zend_Date();
            $insertData[$this->_updatedColumn] = new Zend_Date();
        }
        if ($this->_createdColumn !== null) {
            $insertData[$this->_createdColumn] = new Zend_Date();
        }

        if (\is_array($this->_sectionColumn)) {
            foreach ($this->_sectionColumn as $key => $sectionColumn) {
                if (isset($section[$key])) {
                    $where[] = $db->quoteInto($sectionColumn . '=?', $section[$key]);
                    $insertData[$sectionColumn] = $section[$key];
                }
return $day == $tomorrow;
    }

    /** * Returns the actual date as new date object * * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input * @return Zend_Date */
    public static function now($locale = null)
    {
        return new Zend_Date(time(), self::TIMESTAMP, $locale);
    }

    /** * Calculate date details * * @param string $calc Calculation to make * @param string|integer|array|Zend_Date $date Date or Part to calculate * @param string $part Datepart for Calculation * @param string|Zend_Locale $locale Locale for parsing input * @return integer|string new date * @throws Zend_Date_Exception */
$this->setSessionId($this->session->getId());

            $this->updateExpiry();
            $this->updateSessionId();

            // Reset failed login count             $this->setFailedLogins(0);
        } elseif ($user) {
            // If more than 4 previous failed logins lock account for n * failedlogins seconds             if ($user->failedlogins >= 4) {
                $lockedUntil = new Zend_Date();
                $lockedUntil->addSecond($this->lockSeconds * $user->failedlogins);
                $this->setLockedUntil($lockedUntil);
            }
            // Increase number of failed logins             $this->setFailedLogins($user->failedlogins + 1);
            if (isset($lockedUntil)) {
                return new Zend_Auth_Result(
                    -4,
                    $this->_identity,
                    ['lockedUntil' => $lockedUntil]
                );
            }
$params['bindInStock'] = $this->cleanData($params['bindInStock'] ?? null);
        $params['bindWeekdayFrom'] = $this->cleanData($params['bindWeekdayFrom']);
        $params['bindWeekdayTo'] = $this->cleanData($params['bindWeekdayTo']);
        $params['bindWeightFrom'] = $this->cleanData($params['bindWeightFrom']);
        $params['bindWeightTo'] = $this->cleanData($params['bindWeightTo']);
        $params['bindPriceFrom'] = $this->cleanData($params['bindPriceFrom']);
        $params['bindPriceTo'] = $this->cleanData($params['bindPriceTo'] ?? null);
        $params['bindSql'] = $this->cleanData($params['bindSql']);
        $params['calculationSql'] = $this->cleanData($params['calculationSql']);

        if (!empty($params['bindTimeFrom'])) {
            $bindTimeFrom = new Zend_Date();
            $bindTimeFrom->set((string) $params['bindTimeFrom'], Zend_Date::TIME_SHORT);
            $bindTimeFrom = (int) $bindTimeFrom->get(Zend_Date::MINUTE) * 60 + (int) $bindTimeFrom->get(Zend_Date::HOUR) * 60 * 60;
            $params['bindTimeFrom'] = $bindTimeFrom;
        } else {
            $params['bindTimeFrom'] = null;
        }

        if (!empty($params['bindTimeTo'])) {
            $bindTimeTo = new Zend_Date();
            $bindTimeTo->set((string) $params['bindTimeTo'], Zend_Date::TIME_SHORT);
            $bindTimeTo = (int) $bindTimeTo->get(Zend_Date::MINUTE) * 60 + (int) $bindTimeTo->get(Zend_Date::HOUR) * 60 * 60;
            
unset($data['table']$data['tableID']);
                break;
            case 'cronJob':
                $data['pluginID'] = isset($data['pluginId']) ? $data['pluginId'] : null;
                $data['inform_mail'] = isset($data['informMail']) ? $data['informMail'] : '';
                $data['inform_template'] = isset($data['informTemplate']) ? $data['informTemplate'] : '';
                $data['disable_on_error'] = isset($data['disableOnError']) ? $data['disableOnError'] : false;
                if ($data['data'] !== '') {
                    unset($data['data']);
                }
                if (empty($data['next'])) {
                    $data['next'] = new Zend_Date();
                }
                if (!empty($data['active']) && empty($data['end'])) {
                    $data['end'] = $data['next'];
                } else {
                    unset($data['end']);
                }
                unset($data['deletable']$data['pluginId']$data['informMail']$data['informTemplate']$data['disableOnError']);
                break;
            default:
                break;
        }

        
return $this->db->insert(
            's_order_basket',
            [
                'sessionID' => $this->session->get('sessionId'),
                'articlename' => trim($premium['articleName'] . ' ' . $premium['additionaltext']),
                'articleID' => $premium['articleID'],
                'ordernumber' => $number,
                'quantity' => 1,
                'price' => 0,
                'netprice' => 0,
                'tax_rate' => 0,
                'datum' => new Zend_Date(),
                'modus' => 1,
                'currencyFactor' => $this->sSYSTEM->sCurrency['factor'],
            ]
        );
    }

    /** * Get the max tax rate in applied in the current basket * Used in several places * * @return float|false May tax value, or false if none found */


            throw $e;
        }
    }

    /** * Ends a job by handing it over to */
    protected function endJob(Enlight_Components_Cron_Job $job)
    {
        $now = new Zend_Date();
        $now = $now->getTimestamp();
        $interval = $job->getInterval();
        $next = $job->getNext()->getTimestamp();
        if ($interval > 0) {
            do {
                $next += $interval;
            } while ($now >= $next);
        } else {
            $next = $now;
        }
        $job->setNext($next);
        
/** * Defined by Zend_Filter_Interface * * Normalizes the given input * * @param string $value Value to normalized * @return string|array The normalized value */
    public function filter($value)
    {
        if (is_array($value)) {
            $date = new Zend_Date($value$this->_options['locale']);
            return $date->toString($this->_options['date_format']);
        } else if ($this->_options['precision'] === 0) {
            return Zend_Locale_Format::toInteger($value$this->_options);
        } else if ($this->_options['precision'] === null) {
            return Zend_Locale_Format::toFloat($value$this->_options);
        }

        return Zend_Locale_Format::toNumber($value$this->_options);
    }
}
Home | Imprint | This part of the site doesn't use cookies.