Timestamp

Convert Linux/Unix timestamp to human readable format in PHP

This functin will help to convert the Linux/Unix timestamp to human readable format:

function unix_timestamp_to_human ($timestamp = "", $format = 'D d M Y - H:i:s')
{
    if (empty($timestamp) || ! is_numeric($timestamp)) $timestamp = time();
    return ($timestamp) ? date($format, $timestamp) : date($format, $timestamp);
}

$unix_time = "1251208071";

echo unix_timestamp_to_human($unix_time); //Return: Tue 25 Aug 2009 - 14:47:51