當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。