本文整理汇总了PHP中Zend_Date::subSecond方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::subSecond方法的具体用法?PHP Zend_Date::subSecond怎么用?PHP Zend_Date::subSecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::subSecond方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _decSec
protected function _decSec($datetime)
{
$date = new Zend_Date($datetime, null, $this->_helper()->getLocale()->getLocaleCode());
$date->subSecond(1);
return $date->toString(self::MYSQL_ZEND_DATE_FORMAT);
}
示例2: 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
}
}
示例3: addDaysFilter
/**
* Adds filter on days in wishlist
*
* $constraints may contain 'from' and 'to' indexes with number of days to look for items
*
* @param array $constraints
* @return Mage_Wishlist_Model_Resource_Item_Collection
*/
public function addDaysFilter($constraints)
{
if (!is_array($constraints)) {
return $this;
}
$filter = array();
$now = Mage::getSingleton('core/date')->date();
$gmtOffset = (int) Mage::getSingleton('core/date')->getGmtOffset();
if (isset($constraints['from'])) {
$lastDay = new Zend_Date($now, Varien_Date::DATETIME_INTERNAL_FORMAT);
$lastDay->subSecond($gmtOffset)->subDay($constraints['from'] - 1);
$filter['to'] = $lastDay;
}
if (isset($constraints['to'])) {
$firstDay = new Zend_Date($now, Varien_Date::DATETIME_INTERNAL_FORMAT);
$firstDay->subSecond($gmtOffset)->subDay($constraints['to']);
$filter['from'] = $firstDay;
}
if ($filter) {
$filter['datetime'] = true;
$this->addFieldToFilter('added_at', $filter);
}
return $this;
}
示例4: subDays
public function subDays($numDays)
{
$date = new \Zend_Date($this->_date, self::FORMAT);
$this->_date = $date->subSecond(60 * 60 * 24 * (int) $numDays)->toString(self::FORMAT);
return $this;
}
示例5: gmtTimezoneFactory
/**
* Convert datetime to GMT timezonne
*
* @param string $datetime
* @return string
*/
public function gmtTimezoneFactory($datetime)
{
$newdate = $datetime;
try {
$dateObj = new Zend_Date($datetime, Zend_Date::ISO_8601);
$dateObj->setTimezone('GMT');
$newdate = $dateObj->subSecond($this->getTimeZoneOffset())->toString(self::MYSQL_ZEND_DATE_FORMAT);
} catch (Exception $e) {
Mage::logException($e->getMessage());
}
return $newdate;
}
示例6: _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);
}
示例7: registerIds
/**
* Add information about product ids to visitor/customer
*
* @param $object
* @param $productIds
*/
public function registerIds($object, $productIds)
{
$row = array('visitor_id' => $object->getVisitorId(), 'customer_id' => $object->getCustomerId(), 'store_id' => $object->getStoreId());
$addedAt = new Zend_Date();
$data = array();
foreach ($productIds as $productId) {
$productId = (int) $productId;
if ($productId) {
$row['product_id'] = $productId;
$row['added_at'] = $addedAt->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
$data[] = $row;
}
$addedAt->subSecond(1);
}
if (!empty($data)) {
$this->_getWriteAdapter()->insertOnDuplicate($this->getMainTable(), $data, array_keys($row));
}
return $this;
}
示例8: decSec
public function decSec($datetime)
{
$date = new Zend_Date($datetime, self::MYSQL_ZEND_DATE_FORMAT, $this->getLocale()->getLocaleCode());
$date->subSecond(1);
return $date->toString(self::MYSQL_ZEND_DATE_FORMAT);
}
示例9: testGetNextJob
public function testGetNextJob()
{
$zendDate = new Zend_Date();
$zendDate->subSecond(10);
$this->jobData['next'] = $zendDate;
unset($this->jobData['id']);
$this->jobData['action'] = 'action_test';
$job = new Enlight_Components_Cron_Job($this->jobData);
$this->manager->addJob($job);
$nextJob = $this->manager->getNextJob();
$this->assertInstanceOf('Enlight_Components_Cron_Job', $nextJob);
}
示例10: testGetNextCronJob
public function testGetNextCronJob()
{
$zendDate = new Zend_Date();
$zendDate->subSecond(10);
$this->jobData['next'] = $zendDate;
$job = new Enlight_Components_Cron_Job($this->jobData);
$this->object->addJob($job);
$nextJob = $this->object->getNextJob();
$this->assertInstanceOf('Enlight_Components_Cron_Job', $nextJob);
}