Assuming you are using PHP5.3 then the modern way of handling dates is via the native DateTime class. To get the current time you can just call
$currentTime = new DateTime();
To create a DateTime object from a specific timestamp (i.e. not now)
$currentTime = DateTime::createFromFormat( 'U', $timestamp );
To get a formatted string you can then call
$formattedString = $currentTime->format( 'c' );
See the manual page here