Pages

PHP timestap to MySQL date

Function given below separates the timestamp and returns as desired,
function timestamp2datime($timestamp){
 $datime = NULL;
 $year = substr($timestamp, 0, 4);
 $month = substr($timestamp, 4, 2);
 $day = substr($timestamp, 6, 2);
 $hour = substr($timestamp, 8, 2);
 $min = substr($timestamp, 10, 2);
 $datime .= "$month/$day/$year {$hour}:$min";

 return $datime;
}
If you wan to change mysql timestamp to php date format,you cann use this.
function timestamp2date($timestamp){
 $date = NULL;
 $year = substr($timestamp, 0, 4);
 $month = substr($timestamp, 4, 2);
 $day = substr($timestamp, 6, 2);  
 $date .= "$month/$day/$year";
 return $date;
}