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


PHP DBConnection::date_to_unix方法代码示例

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


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

示例1: determineValue

 /**
  * Determine Widget Value
  *
  * Determines the correct source to use for the value of this widget and
  * format that value as such: MM-DD-YYYY or DD-MM-YYYY
  * The order goes like this:
  *   5. No value
  *   4. The default value set in the config file
  *   3. The value given by the 'value' parameter of the {form_field} tag
  *   2. The value of this field in the specified DBO
  *   1. The value as entered by the user
  *
  * @param array $params Paramets passed from the template
  * @throws SWException
  * @return string The value to use
  */
 protected function determineValue($params)
 {
     $value = parent::determineValue($params);
     if (is_string($value)) {
         $tsValue = strlen($value) > 10 ? DBConnection::datetime_to_unix($value) : DBConnection::date_to_unix($value);
     } else {
         $tsValue = $value;
     }
     return $this->TS2Date($tsValue == null ? time() : $tsValue);
 }
开发者ID:carriercomm,项目名称:NeoBill,代码行数:26,代码来源:DateWidget.class.php

示例2: generate

 /**
  * Generate Invoice
  *
  * Given an Account to generate the invoice for and a period for which to bill,
  * this function will search out any purchases that occured during that period
  * and add an InvoiceItem to the Invoice for each purchase.
  *
  * @return boolean True on success
  */
 public function generate()
 {
     if (!($this->getAccountID() || $this->getPeriodBegin() || $this->getPeriodEnd())) {
         throw new SWException("Missing necessary information to generate this invoice");
     }
     $periodBeginTS = DBConnection::datetime_to_unix($this->getPeriodBegin());
     $periodEndTS = DBConnection::datetime_to_unix($this->getPeriodEnd());
     // Bill all applicable purchases for the account
     foreach ($this->accountDBO->getPurchases() as $purchaseDBO) {
         $taxes = 0;
         // Bill onetime price if necessary
         if ($purchaseDBO->getPrevInvoiceID() == 0 && $purchaseDBO->getOnetimePrice() > 0) {
             $taxes += $purchaseDBO->getOnetimeTaxes();
             $this->add_item(1, $purchaseDBO->getOnetimePrice(), $purchaseDBO->getLineItemTextOneTime(), false);
         }
         // Bill the purchase as many times as necessary during the period
         $nextBillingDateTS = DBConnection::date_to_unix($purchaseDBO->getNextBillingDate());
         $recurCount = 0;
         while ($nextBillingDateTS >= $periodBeginTS && $nextBillingDateTS < $periodEndTS) {
             // Calculate the "new next" billing date for this purchase
             if ($purchaseDBO->getTerm() == 0) {
                 // Do not bill again
                 $nextBillingDateTS = null;
                 $purchaseDBO->setNextBillingDate(null);
             } else {
                 // Increment the recurring count
                 $recurCount++;
                 // Increment the next billing date by term
                 $nextBillingDateTS = DBConnection::date_to_unix($purchaseDBO->incrementNextBillingDate());
             }
             // The -1 will be replaced by the invoice ID in add_InvoiceDBO
             $purchaseDBO->setPrevInvoiceID(-1);
             // Add this purchase to the list of purchase DBO's to update when
             // the invoice is added to the database
             $this->updatePurchases[] = $purchaseDBO;
         }
         // Bill the recurring price (if exists)
         if ($recurCount > 0 && $purchaseDBO->getRecurringPrice() > 0) {
             $taxes += $purchaseDBO->getRecurringTaxes() * $recurCount;
             $this->add_item($recurCount, $purchaseDBO->getRecurringPrice(), $purchaseDBO->getLineItemTextRecurring(), false);
         }
         // Charge taxes
         if ($taxes > 0) {
             $this->add_item(1, $taxes, $purchaseDBO->getLineItemTextTax(), true);
         }
     }
     // Done
     return true;
 }
开发者ID:carriercomm,项目名称:NeoBill,代码行数:58,代码来源:InvoiceDBO.class.php

示例3: incrementNextBillingDate

 /**
  * Increment Next Billing Date
  */
 public function incrementNextBillingDate()
 {
     $nextBillingDateTS = DBConnection::date_to_unix($this->getNextBillingDate());
     $oldBillingDate = getdate($nextBillingDateTS);
     $nextBillingDate = DBConnection::format_date(mktime(0, 0, 1, $oldBillingDate['mon'] + $this->getTerm(), $oldBillingDate['mday'], $oldBillingDate['year']));
     $this->setNextBillingDate($nextBillingDate);
     return $nextBillingDate;
 }
开发者ID:carriercomm,项目名称:NeoBill,代码行数:11,代码来源:PurchaseDBO.class.php


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