Location: PHPKode > scripts > My Date > my-date/myDate.php
<?php
//****************
//written by Todd Mc Brearty
//hide@address.com
//use and abuse freely
//****************
class myDate
{
  var $_mydate; 
  var $_y;
  var $_m;
  var $_d; 
  var $_s1 = "-";
  var $_s2 = "-";

  function myDate()
  {
    $this->_y = Date("Y");
    $this->_m = Date("m");
    $this->_d = Date("d"); 
    $this -> _mydate = Date("Y-m-d",mktime(0,0,0,$this->_m,$this->_d,$this->_y));
  } 

  function set_seperator($seperator1, $seperator2 = "") // sets seperator between each item if second argument is empty it defaluts to the first
  {
    $this->_s1 = $seperator1;
    $this->_s2 =  ($seperator2 != "") ?  $seperator2 :  $seperator1;
  }

  function format_date() // displays the date in the order you want. the read me file has all the date codes for easy look up. PRINT IT OUT
  {
    $setDisplayOrder = func_get_args();
    $this -> _mydate = Date($setDisplayOrder[0].$this->_s1.$setDisplayOrder[1].$this->_s2.$setDisplayOrder[2],mktime(0,0,0,$this->_m,$this->_d,$this->_y));
   }  

function get_date() //returns the date
  {
    return $this->_mydate;  // you get the date in same format as Date("Y-m-d")
  }  

}  
?>
Return current item: My Date