mySQL Timestamp convert to RSS PubDate

mySQL Timestamp convert to RSS PubDate:

<?php
$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);
$sec = substr($timestamp, 12, 2);
$pubdate = date(‘D, d M Y H:i:s O’, mktime($hour, $min, $sec, $month, $day, $year));
?>

even better way:

<?php $pubdate = date(‘D, d M Y H:i:s O’, strtotime($timestamp)); ?>

 

via mySQL Timestamp convert to RSS PubDate – PHP Code Snippet.