| px | top | add code | search | signup | login | help |
<?php
//$date is YYYY-MM-DDThh:mm:ss.sTZD(Ex:2001-08-02T10:45:23+09:00) or etc.
function splitW3CDTF($date){
list($date,$time)=explode("T",$date);
list($time,$timeZone)=explode("+",$time);
if($timeZone){
$timeZone="+$timeZone";
}else{
list($time,$timeZone)=explode("-",$time);
if($timeZone){
$timeZone="-$timeZone";
}else{
if(strstr($time,"Z")){$timeZone="+00:00";$time=array_shift(explode("Z",$time));}
}
}
list($year,$month,$day)=explode("-",$date);
list($hour,$min,$sec)=explode(":",$time);
$timeStamp["year"]=(int)$year;
$timeStamp["month"]=(int)$month;
$timeStamp["day"]=(int)$day;
$timeStamp["hour"]=(int)$hour;
$timeStamp["min"]=(int)$min;
$timeStamp["sec"]=(float)$sec;
$timeStamp["TMZ"]=$timeZone;
return $timeStamp;
}
?>
Comments or questions?
PX is running PHP 5.2.11
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.