Convertire una data RFC822 in una normale
by info@fabioricali.it on giu.09, 2010, under PHP
Questa funzione ci permette di convertire una data GMT in un formato data normale
<?php function RFC822ToDate($gmtDate, $format="it", $showTime=true){ list($dayT, $dayN, $monthT, $year, $time) = explode(" ",$gmtDate); $dayT = trim($dayT,","); $months = array("01"=>"Jan","02"=>"Feb","03"=>"Mar","04"=>"Apr","05"=>"May","06"=>"Jun","07"=>"Jul","08"=>"Aug","09"=>"Sep","10"=>"Oct","11"=>"Nov","12"=>"Dec"); $monthT = array_search($monthT, $months); if(!$showTime) $time = ""; switch($format){ case "it": $date = $dayN."-".$monthT."-".$year." ".$time ; break; case "us": $date = $year."-".$monthT."-".$dayN." ".$time ; break; default: $date = $year."-".$monthT."-".$dayN." ".$time ; break; } return $date; } echo RFC822ToDate("Tue, 08 Nov 2014 06:47:10 GMT"); //stampa 08-11-2014 06:47:10 ?>