本文整理汇总了PHP中Zend_Date::addSecond方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::addSecond方法的具体用法?PHP Zend_Date::addSecond怎么用?PHP Zend_Date::addSecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::addSecond方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSavedTime
public function getSavedTime()
{
$seconds = intval(Mage::helper('asyncindex')->getVariable('time'));
$time = new Zend_Date();
$time->setTime('00:00:00');
$time->addSecond($seconds);
return $time->toString('HH') . ' hr ' . $time->toString('mm') . ' min ' . $time->toString('ss') . ' sec';
}
示例2: _incSec
protected function _incSec($datetime)
{
$date = new Zend_Date($datetime, null, $this->_helper()->getLocale()->getLocaleCode());
$date->addSecond(1);
return $date->toString(self::MYSQL_ZEND_DATE_FORMAT);
}
示例3: authenticate
/**
* authenticate() - defined by Zend_Auth_Adapter_Interface. This method is called to
* attempt an authentication. Previous to this call, this adapter would have already
* been configured with all necessary information to successfully connect to a database
* table and attempt to find a record matching the provided identity.
*
* @throws Zend_Auth_Adapter_Exception if answering the authentication query is impossible
* @return Zend_Auth_Result
*/
public function authenticate()
{
$result = parent::authenticate();
if ($result->isValid()) {
$this->updateExpiry();
$this->updateSessionId();
} else {
$datetime = new Zend_Date();
$datetime->addSecond($this->lockSeconds);
$this->setLockedUntil($datetime);
}
return $result;
}
示例4: authenticate
/**
* authenticate() - defined by Zend_Auth_Adapter_Interface. This method is called to
* attempt an authentication. Previous to this call, this adapter would have already
* been configured with all necessary information to successfully connect to a database
* table and attempt to find a record matching the provided identity.
*
* @throws Zend_Auth_Adapter_Exception if answering the authentication query is impossible
* @return Zend_Auth_Result
*/
public function authenticate()
{
$result = parent::authenticate();
$select = $this->_zendDb->select();
$select->from($this->_tableName);
$select->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity);
$user = $this->_zendDb->fetchRow($select, array(), Zend_Db::FETCH_OBJ);
if ($result->isValid()) {
// Check if user role is active
$sql = 'SELECT enabled FROM s_core_auth_roles WHERE id = ?';
if ($this->_zendDb->fetchOne($sql, array($user->roleID)) == false) {
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND,
$this->_identity, array()
);
}
$this->updateExpiry();
$this->updateSessionId();
} else {
// If more then 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,
array('lockedUntil' => $lockedUntil)
);
}
}
return $result;
}
示例5: testLoose
//.........这里部分代码省略.........
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareHour(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareMinute(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareSecond(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->setWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->addWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->subWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
try {
$date->compareWeek(null);
$this->fail();
} catch (Zend_Date_Exception $e) {
// success
}
}
示例6: timezoneFactory
/**
* Make correction for store timezone
*
* @param string $datetime
* @return string
*/
public function timezoneFactory($datetime)
{
$newdate = $datetime;
try {
$dateObj = new Zend_Date($datetime, Zend_Date::ISO_8601);
$dateObj->setTimezone('GMT');
$newdate = $dateObj->addSecond($this->getTimeZoneOffset())->toString(self::MYSQL_ZEND_DATE_FORMAT);
} catch (Exception $e) {
Mage::logException($e->getMessage());
}
return $newdate;
}
示例7: addDays
public function addDays($numDays)
{
$date = new \Zend_Date($this->_date, self::FORMAT);
$this->_date = $date->addSecond(60 * 60 * 24 * (int) $numDays)->toString(self::FORMAT);
return $this;
}
示例8: getShippingCostsAction
/**
* Returns all Shipping Costs
*
* @return array
*/
public function getShippingCostsAction()
{
$dispatchID = $this->Request()->getParam('dispatchID', null);
$limit = $this->Request()->getParam('limit', 20);
$offset = $this->Request()->getParam('start', 0);
$sort = $this->Request()->getParam('sort', array(array('property' => 'dispatch.name', 'direction' => 'ASC')));
$filter = $this->Request()->getParam('filter', null);
if (is_array($filter) && isset($filter[0]['value'])) {
$filter = $filter[0]['value'];
}
$query = $this->getRepository()->getShippingCostsQuery($dispatchID, $filter, $sort, $limit, $offset);
$shippingCosts = $query->getArrayResult();
$shippingCostsResult = array();
foreach ($shippingCosts as $shippingCost) {
if (!empty($shippingCost['bindTimeFrom'])) {
$date = new Zend_Date();
$date->setMinute(0);
$date->setHour(0);
$date->setSecond(0);
$shippingCost['bindTimeFrom'] = $date->addSecond($shippingCost['bindTimeFrom'])->toString("HH:mm");
}
if (!empty($shippingCost['bindTimeTo'])) {
$date = new Zend_Date();
$date->setMinute(0);
$date->setHour(0);
$date->setSecond(0);
$shippingCost['bindTimeTo'] = $date->addSecond($shippingCost['bindTimeTo'])->toString("HH:mm");
}
$shippingCostsResult[] = $shippingCost;
}
//returns the total count of the query
$totalResult = $this->getManager()->getQueryCount($query);
$this->View()->assign(array('success' => true, 'data' => $shippingCostsResult, 'total' => $totalResult));
}
示例9: _calculateDateFromOffsetDays
protected function _calculateDateFromOffsetDays(Date $referenceDate, $referenceDateOffset)
{
$referenceDate = new \Zend_Date((string) $referenceDate, Date::FORMAT);
$referenceDateOffset = (int) $referenceDateOffset;
if ($referenceDateOffset >= 0) {
return $referenceDate->addSecond(60 * 60 * 24 * $referenceDateOffset)->toString(Date::FORMAT);
}
return $referenceDate->subSecond(60 * 60 * 24 * $referenceDateOffset * -1)->toString(Date::FORMAT);
}
示例10: incSec
public function incSec($datetime)
{
$date = new Zend_Date($datetime, self::MYSQL_ZEND_DATE_FORMAT, $this->getLocale()->getLocaleCode());
$date->addSecond(1);
return $date->toString(self::MYSQL_ZEND_DATE_FORMAT);
}
示例11: explode
$view = $application->getBootstrap()->getResource('View');
// init request
$request = new Zend_Controller_Request_Http();
$request->setControllerName('partner-usage');
$request->setActionName('export-csv');
$fromDate = new Zend_Date();
$fromDate->setHour(0);
$fromDate->setMinute(0);
$fromDate->setSecond(0);
$fromDate->setDay(1);
$fromDate->addMonth(-1);
$request->setParam('from_date', $fromDate->getTimestamp());
// beginning of last month
$toDate = new Zend_Date($fromDate);
$toDate->addMonth(1);
$toDate->addSecond(-1);
$request->setParam('to_date', $toDate->getTimestamp());
// end of last month
// init response
$response = new Zend_Controller_Response_Cli();
// dispatch
$frontController->getDispatcher()->dispatch($request, $response);
// send mail
$config = Zend_Registry::get('config');
$sentToArray = explode(',', $config->settings->monthlyUsageSendTo);
$mail = new Zend_Mail();
$mail->setSubject($view->translate('Monthly Report'));
$mail->setFrom($config->settings->monthlyUsageSendFrom);
$mail->setBodyText($view->translate('CSV file attached.'));
// the attachment
$attachment = new Zend_Mime_Part($response->getBody());