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


PHP Timestamp::setDate方法代码示例

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


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

示例1: getBlogDate

 /**
  * @static
  * returns a Timestamp object with the blog time difference already
  * applied, if needed
  *
  * @param blog either a blog id or a BlogInfo object
  * @param timestamp 
  * @return A Timestamp object with time difference applied, if needed
  * @see BlogInfo
  */
 function getBlogDate($blog, $timestamp = null)
 {
     // check whether time differences are dynamically or statically
     // applied, because in case of the former, we don't have to do
     // anything here!
     $config =& Config::getConfig();
     if ($config->getValue("time_difference_calculation") == TIME_DIFFERENCE_CALCULATION_DYNAMIC) {
         return new Timestamp($timestamp);
     }
     //
     // how's this for function overloading??
     // I know it's quite hackish, but it's a bit of a pain that
     // we need to define two different functions depending on whether
     // we're getting an object or an integer!
     //
     if (is_object($blog)) {
         $blogSettings = $blog->getSettings();
         $timeDifference = $blogSettings->getValue("time_offset");
     } else {
         include_once PLOG_CLASS_PATH . "class/dao/blogs.class.php";
         $blogs = new Blogs();
         $blogInfo = $blogs->getBlogInfoById($blog);
         if (!$blogInfo) {
             $timeDifference = 0;
         } else {
             $blogSettings = $blogInfo->getSettings();
             $timeDifference = $blogSettings->getValue("time_offset");
         }
     }
     // generate the date with the correct time difference applied
     $t = new Timestamp();
     $t->setDate(Timestamp::getDateWithOffset($t->getDate(), $timeDifference), DATE_FORMAT_TIMESTAMP);
     return $t;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:44,代码来源:timestamp.class.php


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