[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/datetime/src/ -> lmbTimePeriod.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/datetime/src/lmbDate.class.php');
  10  lmb_require('limb/datetime/src/lmbDatePeriod.class.php');
  11  
  12  /**

  13   * class lmbTimePeriod.

  14   *

  15   * @package datetime

  16   * @version $Id: lmbTimePeriod.class.php 5945 2007-06-06 08:31:43Z pachanga $

  17   */
  18  class lmbTimePeriod extends lmbDatePeriod
  19  {
  20    function __construct($start, $end)
  21    {
  22      $start_date = new lmbDate($start);
  23      $end_date = new lmbDate($end);
  24  
  25      parent :: __construct($start_date->setYear(0)->setMonth(0)->setDay(0),
  26                            $end_date->setYear(0)->setMonth(0)->setDay(0));
  27    }
  28  
  29    function getDatePeriod($date)
  30    {
  31      $date = new lmbDate($date);
  32      $year = $date->getYear();
  33      $month = $date->getMonth();
  34      $day = $date->getDay();
  35  
  36      $start_date = new lmbDate($year, $month, $day,
  37                                $this->start->getHour(), $this->start->getMinute(), $this->start->getSecond());
  38  
  39      $end_date = new lmbDate($year, $month, $day,
  40                              $this->end->getHour(), $this->end->getMinute(), $this->end->getSecond());
  41  
  42      return new lmbDatePeriod($start_date, $end_date);
  43    }
  44  }
  45  
  46  ?>


Generated: Fri Dec 5 04:05:07 2008 Cross-referenced by PHPXref 0.7