Location: PHPKode > scripts > Get Futurist Date > get-futurist-date/GetFuturistDate.class.php
<?php

/*
//------------------------------------------------------------------------------------------------------------
|| @ Script Desc  : Get a futurist date from today date to your adding date
|| @ Version      : 1.0 beta
|| @ Created      : NAIF PHP
|| @ Web Site     : www.naifphp.net
|| @ Date Created : 22 - 8 - 2006
//--------------------------------------------------------------------------------------------------------------
*/


Class GetFuturistDate
{

      var $date_format = "d / m / Y"; // date formatting day / month / year
      var $_day        = "0"; // set day
      var $_month      = "0"; // set month
      var $_year       = "0"; // set year


      function FuturistDate($d="0", $m="0", $y="0")
      {
              $d  = intval (str_replace('-','',$d));
              $m  = intval (str_replace('-','',$m));
              $y  = intval (str_replace('-','',$y));

              $this->_day     = $d;
              $this->_month   = $m;
              $this->_year    = $y;

              $convert = strtotime("$d days $m months $y years ");

              if ($convert == '-1')
              {
                      die ("error , in adding date !!");
              }
              else
              {

                      $ToDay = date("$this->date_format");
                      $DateToDayInfo = explode('/', $ToDay);

                      $_FuturistDate = date("$this->date_format", $convert);
                      $GetFuturistDate = explode('/',$_FuturistDate);

                      $balance['day']    = str_replace('-','',$GetFuturistDate[0] - $DateToDayInfo[0]);
                      $balance['month']  = str_replace('-','',$GetFuturistDate[1] - $DateToDayInfo[1]);
                      $balance['year']   = str_replace('-','',$GetFuturistDate[2] - $DateToDayInfo[2]);


                      $FuturistDate = array(

                              /* Output Date '1176843600' */
                              "UNIX"          =>    $convert,

                              /* Outputd Futurist Date ' 22 / 8 / 2006' */
                              "FUTURISTDATE"  =>    $_FuturistDate,

                              /* Output balance days */
                              "BDAY"          =>    $balance['day'],

                              /* Output balance months */
                              "BMONTH"        =>    $balance['month'],

                              /* Output balance Years */
                              "BYEAR"         =>    $balance['year'],

                              /* Output ToDay Date */
                              "TODAY"         =>    $ToDay

                              );

              }

          return $FuturistDate;

      }
}

?>


Return current item: Get Futurist Date