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


PHP float::format方法代码示例

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


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

示例1: getShippedOn

 public function getShippedOn()
 {
     if ($this->shippedOn) {
         return $this->shippedOn->format('d-m-Y');
     } else {
         return false;
     }
 }
开发者ID:bardascat,项目名称:blogify,代码行数:8,代码来源:Order.php

示例2: writeQTime

 /**
  * Writes a QTime for the given timestamp or DateTime object
  *
  * The QTime will only carry the number of milliseconds since midnight.
  * This means you should probably only use this for times within the current
  * day.
  *
  * If you pass a timestamp from any other day, it will write the number of
  * milliseconds that passed since that day's midnight. Note that reading
  * this number has no indication this is not the current day, so you're
  * likely going to lose the day information and may end up with wrong dates.
  *
  * The QTime will be sent as the number of milliseconds since midnight,
  * without any awareness of timezone or DST properties. Thus, writing this
  * will assume it is relative to the current timezone. This means that the
  * time "14:10:34.5108" will be 14h after midnight, irrespective of its
  * actual timezone. The receiving side may not be aware of your local
  * timezone, so it can only assume its own local timezone as a base.
  *
  * Make sure to use (i.e. convert via `setTimeZone()`) to the same timezone
  * on both sides or consider using the `writeQDateTime()` method instead,
  * which uses absolute time stamps and does not suffer from this.
  *
  * You can also pass a Unix timestamp to this function, this will be assumed
  * to be relative to the local midnight timestamp. If you need more control
  * over your timezone, consider passing a `DateTime` object instead.
  *
  * @param DateTime|float $timestamp
  * @see self::writeQDateTime
  */
 public function writeQTime($timestamp)
 {
     if ($timestamp instanceof \DateTime) {
         $msec = $timestamp->format('H') * 3600000 + $timestamp->format('i') * 60000 + $timestamp->format('s') * 1000 + (int) ($timestamp->format('0.u') * 1000);
     } else {
         $msec = round(($timestamp - strtotime('midnight', (int) $timestamp)) * 1000);
     }
     $this->writer->writeUInt32BE($msec);
 }
开发者ID:clue,项目名称:qdatastream,代码行数:39,代码来源:Writer.php


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