Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/date_new.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                                                   **
     **                                                                           **
     *******************************************************************************/

if($rsspubdate=="")
 $rsspubdate=date("Y/n/j");
else
 $rsspubdate=$rsspubdate;

if(strstr($rsspubdate,","))
{
  $date=explode(" ",$rsspubdate);
  $newT=$date[4];
  if(strstr($newT,"GMT"))
    $newtime=$rsshour;
  elseif(strstr($newT,":"))
  {
  	$newT=explode(":",$newT);
  	$newtime=$newT[0].":".$newT[1];
  }
  else{
    $newtime=$rsshour;
  }

 if(strstr($date[1],"-"))
  {
     $datehyp=explode("-",$date[1]);
		if(substr($datehyp[0],0,1)==0)
		 	$datehyp[0]=str_replace("0","",$datehyp[0]);
		else
			 $datehyp[0]=$datehyp[0];

    // $newdate= $datehyp[0]."/".get_month($datehyp[1])."/".$datehyp[2];
      $newdate= $datehyp[2]."/".get_month($datehyp[1])."/".$datehyp[0];

  }
  else
  {
     if(empty($date[1]))
     {
       if(substr($date[2],0,1)==0)
	    $date[2]=str_replace("0","",$date[2]);
	   else
	    $date[2]=$date[2];

       // $newdate=$date[2]."/".get_month($date[3])."/".$date[4];
        $newdate=$date[4]."/".get_month($date[3])."/".$date[2];

     }
     else
     {
       if(substr($date[1],0,1)==0)
	 	 $date[1]=str_replace("0","",$date[1]);
	   else
	 	 $date[1]=$date[1];

      // $newdate=$date[1]."/".get_month($date[2])."/".$date[3];
       $newdate=$date[3]."/".get_month($date[2])."/".$date[1];


     }
   }
 }
 elseif(!strstr($rsspubdate,",") && strstr($rsspubdate,"-"))
 {
   $date=explode("-",$rsspubdate);
   $newT=explode("T",$date[2]);
   $newT=$newT[1];
    if(strstr($newT,"GMT"))
       $newtime=$rsshour;
    elseif(strstr($newT,":"))
   {
      $newtime=explode(":",$newT);
      $newtime=$newtime[0].":".$newtime[1];
    }else{
       $newtime=$rsshour;
    }

   $hypdat=substr($date[2],0,2);
       if(substr($hypdat,0,1)==0)
   		 $hypdat=str_replace("0","",$hypdat);
   		else
		 $hypdat=$hypdat;

    if(substr($date[1],0,1)==0)
	  $date[1]=str_replace("0","",$date[1]);
	 else
	  $date[1]=$date[1];

// $newdate=$hypdat."/".$date[1]."/".$date[0];
   $newdate=$date[0]."/".$date[1]."/".$hypdat;


}
else
{
  $newdate=$rsspubdate;
  $newtime=$rsshour;

}

?>
Return current item: News Manager - RSS aggregator