当前位置: 首页>>代码示例>>PHP>>正文


PHP DateTimeUtil::convertTimestampToDisplayFormat方法代码示例

本文整理汇总了PHP中DateTimeUtil::convertTimestampToDisplayFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::convertTimestampToDisplayFormat方法的具体用法?PHP DateTimeUtil::convertTimestampToDisplayFormat怎么用?PHP DateTimeUtil::convertTimestampToDisplayFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateTimeUtil的用法示例。


在下文中一共展示了DateTimeUtil::convertTimestampToDisplayFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUpdateMeetingFromForm

 /**
  * @depends testCreateAndGetMeetingById
  */
 public function testUpdateMeetingFromForm()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = User::getByUsername('billy');
     $meetings = Meeting::getByName('MyMeeting');
     $meeting = $meetings[0];
     $this->assertEquals($meeting->name, 'MyMeeting');
     $timeStamp = time();
     $newStamp = DateTimeUtil::convertTimestampToDbFormatDateTime($timeStamp);
     $postData = array('owner' => array('id' => $user->id), 'name' => 'New Name', 'startDateTime' => DateTimeUtil::convertTimestampToDisplayFormat($timeStamp, DateTimeUtil::DATETIME_FORMAT_DATE_WIDTH, DateTimeUtil::DATETIME_FORMAT_TIME_WIDTH, true));
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($meeting, $postData);
     $meeting->setAttributes($sanitizedPostData);
     $saved = $meeting->save();
     $this->assertTrue($saved);
     $id = $meeting->id;
     unset($meeting);
     $meeting = Meeting::getById($id);
     $this->assertEquals('New Name', $meeting->name);
     $this->assertEquals($sanitizedPostData['startDateTime'], $meeting->startDateTime);
     //create new meeting from scratch where the startDateTime and endDateTime attributes are not populated.
     //It should let you save.
     $meeting = new Meeting();
     $postData = array('owner' => array('id' => $user->id), 'name' => 'Lamazing', 'startDateTime' => DateTimeUtil::convertTimestampToDisplayFormat($timeStamp, DateTimeUtil::DATETIME_FORMAT_DATE_WIDTH, DateTimeUtil::DATETIME_FORMAT_TIME_WIDTH, true));
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($meeting, $postData);
     $meeting->setAttributes($sanitizedPostData);
     $saved = $meeting->save();
     $this->assertTrue($saved);
     $id = $meeting->id;
     unset($meeting);
     $meeting = Meeting::getById($id);
     $this->assertEquals('Lamazing', $meeting->name);
     $this->assertEquals($sanitizedPostData['startDateTime'], $meeting->startDateTime);
     $this->assertEquals(null, $meeting->endDateTime);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:37,代码来源:MeetingTest.php

示例2: actionGetMeetingEndDateTimeBasedOnStartDateTime

 public function actionGetMeetingEndDateTimeBasedOnStartDateTime($startDateTime = null)
 {
     Yii::app()->getClientScript()->setToAjaxMode();
     if ($startDateTime == null) {
         return null;
     }
     $timestamp = CDateTimeParser::parse($startDateTime, DateTimeUtil::getLocaleDateTimeFormatForInput());
     if ($timestamp == null) {
         return null;
     }
     $endTimeStamp = $timestamp + 15 * 60;
     $endDateTime = DateTimeUtil::convertTimestampToDisplayFormat((int) $endTimeStamp, DateTimeUtil::DATETIME_FORMAT_DATE_WIDTH, DateTimeUtil::DATETIME_FORMAT_TIME_WIDTH, true);
     echo CJSON::encode(array('endDateTime' => $endDateTime));
     Yii::app()->end(0, false);
 }
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info,代码行数:15,代码来源:DefaultController.php


注:本文中的DateTimeUtil::convertTimestampToDisplayFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。