Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/date.php
<?php
	/*******************************************************************************
     **  File          :  date.php                                                **
     **  Author        :  G.Ramkumar                                              **
     **  Description   :  changing the date as dd/mm/yyyy format			      **
  	 **  Date          :  14/07/2005                                              **
     **  Last Modified :  02/08/2005                                              **
     **  PHP Version   :  5.0.3                                                   **
     **                                                                           **
     *******************************************************************************/
function get_month($month)
{
     $month_char = array('Jan'=>1,'Feb'=>2,'Mar'=>3,'Apr'=>4,'May'=>5,'Jun'=>6,'Jul'=>7,'Aug'=>8,'Sep'=>9,'Oct'=>10,'Nov'=>11,'Dec'=>12);
     foreach($month_char as $mon=>$value)
     {
       if($mon==$month)
       {
	    return ($value);
       }
      }
}


if(strstr($pubdate,",")){
  $date=explode(" ",$pubdate);
  if(strstr($date[1],"-")){
    $datehyp=explode("-",$date[1]);
    $newdate= $datehyp[0]."/".get_month($datehyp[1])."/".$datehyp[2];
  }else{
    $newdate=$date[1]."/".get_month($date[2])."/".$date[3];
  }

}elseif(!strstr($pubdate,",") && strstr($pubdate,"-")){
   $date=explode("-",$pubdate);
   $newdate=substr($date[2],0,2)."/".$date[1]."/".$date[0];

}else{
  $newdate=$pubdate;
}



?>
Return current item: News Manager - RSS aggregator