本文整理汇总了PHP中Tinebase_DateTime类的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_DateTime类的具体用法?PHP Tinebase_DateTime怎么用?PHP Tinebase_DateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tinebase_DateTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getFilterImap
/**
*
* @return type
*/
public function getFilterImap()
{
$format = "d-M-Y";
// prepare value
$value = (array) $this->_getDateValues($this->_operator, $this->_value);
$timezone = Tinebase_Helper::array_value('timezone', $this->_options);
$timezone = $timezone ? $timezone : Tinebase_Core::getUserTimezone();
foreach ($value as &$date) {
$date = new Tinebase_DateTime($date);
// should be in user timezone
$date->setTimezone(new DateTimeZone($timezone));
}
switch ($this->_operator) {
case 'within':
case 'inweek':
$value[1]->add(new DateInterval('P1D'));
// before is not inclusive, so we have to add a day
$return = "SINCE {$value[0]->format($format)} BEFORE {$value[1]->format($format)}";
break;
case 'before':
$return = "BEFORE {$value[0]->format($format)}";
break;
case 'after':
$return = "SINCE {$value[0]->format($format)}";
break;
case 'equals':
$return = "ON {$value[0]->format($format)}";
}
return $return;
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:34,代码来源:DateTime.php
示例2: toArray
/**
* returns array with the filter settings of this filter
* - convert value to user timezone
*
* @param bool $_valueToJson resolve value for json api?
* @return array
*/
public function toArray($_valueToJson = false)
{
$result = parent::toArray($_valueToJson);
if ($this->_operator != 'within' && $this->_operator != 'inweek' && $_valueToJson == true) {
$date = new Tinebase_DateTime($result['value']);
$date->setTimezone(Tinebase_Core::get(Tinebase_Core::USERTIMEZONE));
$result['value'] = $date->toString(Tinebase_Record_Abstract::ISO8601LONG);
}
return $result;
}
开发者ID:,项目名称:,代码行数:17,代码来源:
示例3: appendFilterSql
/**
* appends sql to given select statement
*
* @param Zend_Db_Select $_select
* @param Tinebase_Backend_Sql_Abstract $_backend
*
* @todo to be removed once we split filter model / backend
*/
public function appendFilterSql($_select, $_backend)
{
$now = new Tinebase_DateTime();
$now->setHour(0)->setMinute(0)->setSecond(0);
$db = Tinebase_Core::getDb();
if ($this->_value == 1) {
$_select->where($db->quoteInto('(' . $db->quoteIdentifier('employment_end') . ' >= ? ', $now, 'datetime') . ' OR ' . $db->quoteIdentifier('employment_end') . ' IS NULL )');
$_select->where($db->quoteInto('( ' . $db->quoteIdentifier('employment_begin') . ' <= ? ', $now, 'datetime') . ' OR ( ' . $db->quoteIdentifier('employment_begin') . ' IS NULL ))');
} else {
$_select->where($db->quoteInto($db->quoteIdentifier('employment_end') . ' < ? ', $now, 'datetime'));
$_select->orWhere($db->quoteInto($db->quoteIdentifier('employment_begin') . ' > ? ', $now, 'datetime'));
}
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:21,代码来源:EmployeeEmployedFilter.php
示例4: testCreateTempFileWithBigSize
/**
* @see 0011156: big files can't be uploaded
*/
public function testCreateTempFileWithBigSize()
{
$size = (double) (3.8 * 1024.0 * 1024.0 * 1024.0);
$tempFile = new Tinebase_Model_TempFile(array('id' => '123', 'session_id' => 'abc', 'time' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG), 'path' => '/tmp/tmpfile', 'name' => 'tmpfile', 'type' => 'unknown', 'error' => 0, 'size' => $size));
$createdTempFile = $this->_instance->create($tempFile);
$this->assertEquals(4080218931.0, $createdTempFile->size);
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:10,代码来源:TempFileTest.php
示例5: _beforeCreate
/**
* @see Tinebase_Setup_DemoData_Abstract
*
*/
protected function _beforeCreate()
{
$this->_ccController = Sales_Controller_CostCenter::getInstance();
$this->_taController = Timetracker_Controller_Timeaccount::getInstance();
$this->_taController->sendNotifications(FALSE);
$this->_tsController = Timetracker_Controller_Timesheet::getInstance();
$this->_tsController->sendNotifications(FALSE);
$this->_tsController->doContainerACLChecks(false);
$this->_contractController = Sales_Controller_Contract::getInstance();
$contracts = $this->_contractController->getAll();
$developmentString = self::$_de ? 'Entwicklung' : 'Development';
$this->_contractsDevelopment = $contracts->filter('title', '/.' . $developmentString . '/', TRUE);
$this->_contractsMarketing = $contracts->filter('title', '/.Marketing/', TRUE);
$this->_loadCostCentersAndDivisions();
if (Tinebase_Application::getInstance()->isInstalled('HumanResources')) {
$this->_empController = HumanResources_Controller_Employee::getInstance();
$filter = new HumanResources_Model_EmployeeFilter(array());
$this->_employees = $this->_empController->search($filter);
}
// set start date to start date of june 1st before last year
$date = Tinebase_DateTime::now();
$this->_startDate = $date->subMonth(3)->setTime(8, 0, 0);
// set clearedDate almost a month after
$this->_clearedDate = clone $this->_startDate;
$this->_clearedDate->addMonth(1)->subDay(2);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:30,代码来源:DemoData.php
示例6: __construct
/**
* the constructor
*
* @param mixed $_requestBody
* @param ActiveSync_Model_Device $_device
* @param string $_policyKey
*/
public function __construct($_requestBody, ActiveSync_Model_Device $_device = null, $_policyKey = null)
{
if ($this->_skipValidatePolicyKey !== true && $_policyKey === null) {
#throw new ActiveSync_Exception_PolicyKeyMissing();
}
if ($this->_skipValidatePolicyKey !== true && ($_policyKey === 0 || $_device->policykey != $_policyKey)) {
#throw new ActiveSync_Exception_ProvisioningNeeded();
}
// should we wipe the mobile phone?
if ($this->_skipValidatePolicyKey !== true && !empty($_policyKey) && $_device->remotewipe >= ActiveSync_Command_Provision::REMOTEWIPE_REQUESTED) {
throw new ActiveSync_Exception_ProvisioningNeeded();
}
$this->_policyKey = $_policyKey;
$this->_device = $_device;
$this->_inputDom = $_requestBody;
$this->_syncTimeStamp = Tinebase_DateTime::now();
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " sync timestamp: " . $this->_syncTimeStamp->get(Tinebase_Record_Abstract::ISO8601LONG));
}
// Creates an instance of the DOMImplementation class
$imp = new DOMImplementation();
// Creates a DOMDocumentType instance
$dtd = $imp->createDocumentType('AirSync', "-//AIRSYNC//DTD AirSync//EN", "http://www.microsoft.com/");
// Creates a DOMDocument instance
$this->_outputDom = $imp->createDocument($this->_defaultNameSpace, $this->_documentElement, $dtd);
$this->_outputDom->formatOutput = false;
$this->_outputDom->encoding = 'utf-8';
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:35,代码来源:Wbxml.php
示例7: testNextScheduledImport
/**
* testNextScheduledImport
*/
public function testNextScheduledImport()
{
$cc = Calendar_Controller_Event::getInstance();
$filter = new Calendar_Model_EventFilter(array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())));
$all = $cc->search($filter);
$this->assertEquals(0, $all->count());
$now = Tinebase_DateTime::now()->subHour(1);
$record = $this->createScheduledImport();
// assert setting timestamp to start value
$this->assertEquals($now->format('YMDHi'), $record->timestamp->format('YMDHi'));
$record = $this->_uit->runNextScheduledImport();
// assert updating timestamp after successful run
$now->addHour(1);
$this->assertEquals($now->format('YMDHi'), $record->timestamp->format('YMDHi'));
$all = $cc->search($filter);
$seq = $all->getFirstRecord()->seq;
// assert all events have been imported
$this->assertEquals(7, $all->count());
// this must not be run, the interval is not exceed
$ret = $this->_uit->runNextScheduledImport();
$all = $cc->search($filter);
$this->assertEquals($seq, $all->getFirstRecord()->seq);
// setting manual timestamp to force run again
$record->timestamp = $record->timestamp->subHour(1)->subSecond(1);
$this->_uit->update($record);
$ret = $this->_uit->runNextScheduledImport();
$all = $cc->search($filter);
$this->assertEquals(7, $all->count());
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:ScheduledImportTest.php
示例8: testWholeCall
/**
* test a whole call cycle - start, connect, disconnect
*
*/
public function testWholeCall()
{
// start call
$call = $this->_backend->callStarted($this->_objects['call']);
$this->assertEquals($this->_objects['call']->destination, $call->destination);
$this->assertTrue(Tinebase_DateTime::now()->sub($call->start)->getTimestamp() >= 0);
// sleep for 2 secs (ringing...)
sleep(2);
// connect call
$call = $this->_backend->getCall($this->_objects['call']->getId());
$ringing = $call->ringing;
$connectedCall = $this->_backend->callConnected($call);
$this->assertEquals($this->_objects['call']->destination, $connectedCall->destination);
$this->assertEquals(-1, $call->start->compare($call->connected));
// sleep for 5 secs (talking...)
sleep(5);
// disconnect call
$call = $this->_backend->getCall($this->_objects['call']->getId());
$duration = $call->duration;
$disconnectedCall = $this->_backend->callDisconnected($call);
$this->assertGreaterThan($duration, $disconnectedCall->duration);
$this->assertLessThan(10, $disconnectedCall->ringing, 'wrong ringing duration');
$this->assertLessThan(15, $disconnectedCall->duration, 'wrong duration');
$this->assertEquals(-1, $disconnectedCall->connected->compare($disconnectedCall->disconnected));
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:ControllerTest.php
示例9: _onAfterExportRecords
protected function _onAfterExportRecords($result)
{
$user = Tinebase_Core::getUser();
$this->_docTemplate->setValue('date', Tinebase_DateTime::now()->format('Y-m-d'));
$this->_docTemplate->setValue('account_n_given', $user->accountFirstName);
$this->_docTemplate->setValue('account_n_family', $user->accountLastName);
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:7,代码来源:Doc.php
示例10: _deleteUserById
/**
* delete user by id
*
* @param string $id
*/
protected function _deleteUserById($id)
{
$where = array($this->_db->quoteIdentifier($this->_propertyMapping['emailUserId']) . ' = ?' => $id, $this->_db->quoteIdentifier($this->_userTable . '.domain') . ' = ?' => $this->_config['domain']);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($where, TRUE));
}
$this->_db->update($this->_userTable, array('is_deleted' => '1', 'last_modified' => Tinebase_DateTime::now()->getIso()), $where);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:DovecotCombined.php
示例11: testBackslashInDescription
/**
* testBackslashInDescription
*
* @see 0009176: iCal adds another backslash to description field
*/
public function testBackslashInDescription()
{
$event = new Calendar_Model_Event(array('summary' => 'CalDAV test', 'dtstart' => Tinebase_DateTime::now(), 'dtend' => Tinebase_DateTime::now()->addHour(1), 'description' => 'lalala \\\\', 'originator_tz' => 'Europe/Berlin', 'creation_time' => Tinebase_DateTime::now(), 'uid' => Tinebase_Record_Abstract::generateUID(), 'seq' => 1));
$converter = Calendar_Convert_Event_VCalendar_Factory::factory(Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX);
$vevent = $converter->fromTine20Model($event)->serialize();
$convertedEvent = $converter->toTine20Model($vevent);
$this->assertEquals($event->description, $convertedEvent->description);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:MacOSXTest.php
示例12: testSetLogout
/**
* Test create a access log and logout to set logout time
*
* @see 0010728: Strange error in tine20 log when performing logout from Web
*/
public function testSetLogout()
{
$accessLog = new Tinebase_Model_AccessLog(array('ip' => '127.0.0.1', 'li' => Tinebase_DateTime::now(), 'result' => Zend_Auth_Result::SUCCESS, 'clienttype' => 'unittest', 'login_name' => 'unittest', 'user_agent' => 'phpunit', 'sessionid' => Tinebase_Record_Abstract::generateUID()), true);
$this->_uit->setSessionId($accessLog);
$this->_uit->create($accessLog);
$accessLog = $this->_uit->setLogout();
$this->assertEquals(Tinebase_DateTime::now()->toString(), $accessLog->lo->toString(), 'logout time mismatch/empty: ' . print_r($accessLog, true));
}
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:AccessLogTest.php
示例13: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
parent::setUp();
$this->_testContainer = $this->_getPersonalContainer('Crm');
$this->objects['lead'] = new Crm_Model_Lead(array('lead_name' => 'PHPUnit', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => new Tinebase_DateTime("2007-12-12"), 'description' => 'Lead Description', 'end' => Tinebase_DateTime::now(), 'turnover' => '200000', 'probability' => 70, 'end_scheduled' => Tinebase_DateTime::now()));
$this->objects['leadWithLink'] = new Crm_Model_Lead(array('lead_name' => 'PHPUnit with contact', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => new Tinebase_DateTime("2007-12-24"), 'description' => 'Lead Description', 'end' => Tinebase_DateTime::now(), 'turnover' => '200000', 'probability' => 50, 'end_scheduled' => Tinebase_DateTime::now()));
$this->objects['linkedContact'] = new Addressbook_Model_Contact(array('adr_one_countryname' => 'DE', 'adr_one_locality' => 'Hamburg', 'adr_one_postalcode' => '24xxx', 'adr_one_region' => 'Hamburg', 'adr_one_street' => 'Pickhuben 4', 'adr_one_street2' => 'no second street', 'adr_two_countryname' => 'DE', 'adr_two_locality' => 'Hamburg', 'adr_two_postalcode' => '24xxx', 'adr_two_region' => 'Hamburg', 'adr_two_street' => 'Pickhuben 4', 'adr_two_street2' => 'no second street2', 'assistent' => 'Cornelius Weiß', 'bday' => '1975-01-02 03:04:05', 'email' => '[email protected]', 'email_home' => '[email protected]', 'note' => 'Bla Bla Bla', 'role' => 'Role', 'title' => 'Title', 'url' => 'http://www.tine20.org', 'url_home' => 'http://www.tine20.com', 'n_family' => 'Kneschke', 'n_fileas' => 'Kneschke, Lars', 'n_given' => 'Lars', 'n_middle' => 'no middle name', 'n_prefix' => 'no prefix', 'n_suffix' => 'no suffix', 'org_name' => 'Metaways Infosystems GmbH', 'org_unit' => 'Tine 2.0', 'tel_assistent' => '+49TELASSISTENT', 'tel_car' => '+49TELCAR', 'tel_cell' => '+49TELCELL', 'tel_cell_private' => '+49TELCELLPRIVATE', 'tel_fax' => '+49TELFAX', 'tel_fax_home' => '+49TELFAXHOME', 'tel_home' => '+49TELHOME', 'tel_pager' => '+49TELPAGER', 'tel_work' => '+49TELWORK'));
$this->objects['linkedTask'] = new Tasks_Model_Task(array('summary' => 'task test'));
Crm_Controller_Lead::getInstance()->create($this->objects['leadWithLink']);
$this->objects['linkedContact'] = Addressbook_Controller_Contact::getInstance()->create($this->objects['linkedContact'], FALSE);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:PdfTest.php
示例14: setUp
/**
* Sets up the fixture.
*
* This method is called before a test is executed.
*/
protected function setUp()
{
$personalContainer = Tinebase_Container::getInstance()->getPersonalContainer(Zend_Registry::get('currentAccount'), 'Crm', Zend_Registry::get('currentAccount'), Tinebase_Model_Grants::GRANT_EDIT);
if ($personalContainer->count() === 0) {
$this->_testContainer = Tinebase_Container::getInstance()->addPersonalContainer(Zend_Registry::get('currentAccount')->accountId, 'Crm', 'PHPUNIT');
} else {
$this->_testContainer = $personalContainer[0];
}
$this->_objects['initialLead'] = new Crm_Model_Lead(array('id' => 120, 'lead_name' => 'PHPUnit', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => Tinebase_DateTime::now(), 'description' => 'Description', 'end' => Tinebase_DateTime::now(), 'turnover' => '200000', 'probability' => 70, 'end_scheduled' => Tinebase_DateTime::now()));
$this->_objects['updatedLead'] = new Crm_Model_Lead(array('id' => 120, 'lead_name' => 'PHPUnit', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => Tinebase_DateTime::now(), 'description' => 'Description updated', 'end' => NULL, 'turnover' => '200000', 'probability' => 70, 'end_scheduled' => NULL));
$this->_backend = new Crm_Backend_Lead();
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:17,代码来源:LeadTest.php
示例15: testUpdateProductLifespan
/**
* testUpdateProductLifespan
*
* @see 0010766: set product lifespan
*/
public function testUpdateProductLifespan()
{
$product1 = $this->getUit()->create(new Sales_Model_Product(array('name' => 'product activates in future', 'lifespan_start' => Tinebase_DateTime::now()->addDay(1))));
$product2 = $this->getUit()->create(new Sales_Model_Product(array('name' => 'product lifespan ended', 'lifespan_end' => Tinebase_DateTime::now()->subDay(1))));
$product3 = $this->getUit()->create(new Sales_Model_Product(array('is_active' => 0, 'name' => 'product lifespan started', 'lifespan_start' => Tinebase_DateTime::now()->subDay(1))));
$product4 = $this->getUit()->create(new Sales_Model_Product(array('is_active' => 0, 'name' => 'product lifespan not yet ended', 'lifespan_end' => Tinebase_DateTime::now()->addDay(1))));
$productsToTest = array(array('expectedIsActive' => 0, 'product' => $product1), array('expectedIsActive' => 0, 'product' => $product2), array('expectedIsActive' => 1, 'product' => $product3), array('expectedIsActive' => 1, 'product' => $product4));
$this->getUit()->updateProductLifespan();
foreach ($productsToTest as $product) {
$updatedProduct = $this->getUit()->get($product['product']);
$this->assertEquals($product['expectedIsActive'], $updatedProduct->is_active, print_r($product['product']->toArray(), true));
}
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:ProductControllerTest.php
示例16: getLastModified
/**
* Returns the last modification time
*
* @return int
*/
public function getLastModified()
{
if ($this->_node instanceof Tinebase_Model_Tree_Node) {
if ($this->_node->last_modified_time instanceof Tinebase_DateTime) {
$timestamp = $this->_node->last_modified_time->getTimestamp();
} else {
$timestamp = $this->_node->creation_time->getTimestamp();
}
} else {
$timestamp = Tinebase_DateTime::now()->getTimestamp();
}
return $timestamp;
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:Node.php
示例17: lockFolder
/**
* try to lock a folder
*
* @param Felamimail_Model_Folder $_folder the folder to lock
* @return bool true if locking was successful, false if locking was not possible
*/
public function lockFolder(Felamimail_Model_Folder $_folder)
{
$folderData = $_folder->toArray();
$data = array('cache_timestamp' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG), 'cache_status' => Felamimail_Model_Folder::CACHE_STATUS_UPDATING);
$where = array($this->_db->quoteInto($this->_db->quoteIdentifier('id') . ' = ?', $folderData['id']), $this->_db->quoteInto($this->_db->quoteIdentifier('cache_status') . ' = ?', $folderData['cache_status']));
if (!empty($folderData['cache_timestamp'])) {
$where[] = $this->_db->quoteInto($this->_db->quoteIdentifier('cache_timestamp') . ' = ?', $folderData['cache_timestamp']);
}
$affectedRows = $this->_db->update($this->_tablePrefix . $this->_tableName, $data, $where);
if ($affectedRows !== 1) {
return false;
}
return true;
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:20,代码来源:Folder.php
示例18: setLogout
/**
* add logout entry to the access log
*
* @param string $_sessionId the session id
* @param string $_ipAddress the ip address the user connects from
* @return void|Tinebase_Model_AccessLog
*/
public function setLogout($_sessionId, $_ipAddress = NULL)
{
try {
$loginRecord = $this->_backend->getByProperty($_sessionId, 'sessionid');
} catch (Tinebase_Exception_NotFound $tenf) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not find access log login record for session id ' . $_sessionId);
return;
}
$loginRecord->lo = Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG);
if ($_ipAddress !== NULL) {
$loginRecord->ip = $_ipAddress;
}
return $this->update($loginRecord);
}
开发者ID:,项目名称:,代码行数:21,代码来源:
示例19: testCreateEvent
public function testCreateEvent()
{
$event = $this->_getEvent();
$event->creation_time = Tinebase_DateTime::now();
$persistentEvent = $this->_backend->create($event);
$event->attendee->cal_event_id = $persistentEvent->getId();
foreach ($event->attendee as $attender) {
$this->_backend->createAttendee($attender);
}
$loadedPersitentEvent = $this->_backend->get($persistentEvent->getId());
$this->assertEquals($event->summary, $loadedPersitentEvent->summary);
$this->_assertAttendee($event->attendee, $loadedPersitentEvent->attendee);
return $loadedPersitentEvent;
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:SqlTest.php
示例20: convertDate
/**
* convert date from sent/received
*
* @param string $_dateString
* @return Zend_Date
*/
public static function convertDate($_dateString)
{
try {
$date = new Tinebase_DateTime($_dateString ? $_dateString : '@0');
$date->setTimezone('UTC');
} catch (Exception $e) {
// try to fix missing timezone char
if (preg_match('/UT$/', $_dateString)) {
$_dateString .= 'C';
}
// try some explicit formats
foreach (self::$dateFormats as $format) {
$date = DateTime::createFromFormat($format, $_dateString);
if ($date) {
break;
}
}
if (!$date) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " Date {$_dateString} could not be converted to DateTime -> using 1970-01-01 00:00:00.");
$date = new Tinebase_DateTime('@0');
}
}
return $date;
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:30,代码来源:Message.php
注:本文中的Tinebase_DateTime类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论