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


PHP Timestamp::getDay方法代码示例

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


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

示例1: getArchiveLink

 /**
  * generates an archive link given a date. 
  *
  * @param date A Timestamp object
  * @return A valid archive link
  */
 function getArchiveLink($date)
 {
     $archiveLinkFormat = $this->_config->getValue('archive_link_format');
     $ownerInfo = $this->_blogInfo->getOwnerInfo();
     // this is quite a dirty one but it works...
     $newDate = $date;
     if (strlen($date) == 6) {
         $newDate = $date . "00000000";
     }
     if (strlen($date) == 8) {
         $newDate = $date . "000000";
     }
     $t = new Timestamp($newDate);
     $params = array("{year}" => $t->getYear(), "{month}" => $t->getMonth(), "{blogname}" => $this->_blogInfo->getMangledBlog(), "{blogowner}" => $ownerInfo->getUsername(), "{blogid}" => $this->_blogInfo->getId());
     if (strlen($date) == 6) {
         $params["{day}"] = "";
     } else {
         $day = $t->getDay();
         if ($day < 10) {
             $day = "0" . $day;
         }
         $params["{day}"] = $day;
     }
     $archiveLink = $this->getBaseUrl() . $this->_replaceTags($archiveLinkFormat, $params);
     return $archiveLink;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:32,代码来源:customrequestgenerator.class.php

示例2: getNumberOfPostsToday

 function getNumberOfPostsToday()
 {
     $today = new Timestamp();
     $todayTimestamp = $today->getYear() . $today->getMonth() . $today->getDay();
     $query = "SELECT COUNT(*) AS total FROM " . $this->getPrefix() . "articles" . " WHERE date LIKE '{$todayTimestamp}%' AND status = 1";
     return $this->getTotalFromQuery($query);
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:7,代码来源:sitestatistics.class.php

示例3: testNonEpoch

 public function testNonEpoch()
 {
     $future = '4683-03-04';
     $after = new Timestamp($future);
     $this->assertEquals('04', $after->getDay());
     $this->assertEquals('03', $after->getMonth());
     $this->assertEquals('4683', $after->getYear());
     $past = '1234-04-03';
     $before = new Timestamp($past);
     $this->assertEquals('03', $before->getDay());
     $this->assertEquals('04', $before->getMonth());
     $this->assertEquals('1234', $before->getYear());
     $this->assertFalse($after->equals($before));
     $this->assertEquals($future, $after->toDate());
     $this->assertEquals($past, $before->toDate());
     $time = ' 00:00.00';
     $this->assertEquals($future . $time, $after->toDateTime());
     $this->assertEquals($past . $time, $before->toDateTime());
     $past = '1-04-03';
     $before = new Timestamp($past);
     $this->assertEquals('03', $before->getDay());
     $this->assertEquals('04', $before->getMonth());
     $this->assertEquals(substr(date('Y', time()), 0, 2) . '01', $before->getYear());
     $past = '14-01-02';
     $before = new Timestamp($past);
     $this->assertEquals('02', $before->getDay());
     $this->assertEquals('01', $before->getMonth());
     $this->assertEquals(substr(date('Y', time()), 0, 2) . '14', $before->getYear());
     $past = '113-01-02';
     $before = new Timestamp($past);
     $this->assertEquals('02', $before->getDay());
     $this->assertEquals('01', $before->getMonth());
     $this->assertEquals('0113', $before->getYear());
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:34,代码来源:TimestampTest.class.php

示例4: testNonEpoch

 public function testNonEpoch()
 {
     $future = '4683-03-04';
     $after = new Timestamp($future);
     $this->assertEquals($after->getDay(), '04');
     $this->assertEquals($after->getMonth(), '03');
     $this->assertEquals($after->getYear(), '4683');
     $past = '1234-04-03';
     $before = new Timestamp($past);
     $this->assertEquals($before->getDay(), '03');
     $this->assertEquals($before->getMonth(), '04');
     $this->assertEquals($before->getYear(), '1234');
     $this->assertFalse($after->equals($before));
     $this->assertEquals($future, $after->toDate());
     $this->assertEquals($past, $before->toDate());
     $time = ' 00:00.00';
     $this->assertEquals($future . $time, $after->toDateTime());
     $this->assertEquals($past . $time, $before->toDateTime());
 }
开发者ID:rero26,项目名称:onphp-framework,代码行数:19,代码来源:TimestampTest.class.php

示例5: checkDateParameter

 /**
  * Checks if there is at least a year and a month in the request
  */
 function checkDateParameter()
 {
     $date = $this->_request->getValue('Date');
     if ($date) {
         $year = substr($date, 0, 4);
         $month = substr($date, 4, 2);
         $day = substr($date, 6, 2);
     } else {
         $t = new Timestamp();
         $year = $t->getYear();
         $month = $t->getMonth();
         $day = $t->getDay();
     }
     $this->_session->setValue('Year', $year);
     $this->_session->setValue('Month', $month);
     $this->_session->setValue('Day', $day);
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:20,代码来源:blogaction.class.php


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