Created
February 24, 2011 01:02
-
-
Save niczak/841548 to your computer and use it in GitHub Desktop.
Convert PostgreSQL timestamp to human readable date.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Convert PostgreSQL timestamp to human readable date | |
function fnDisplay_Timestamp($sDT) | |
{ | |
// Assuming $sDT is in format: YYYY-MM-DD HH:MM:SS.MS | |
if(empty($sDT)) | |
fnErr("No parameter passed to fnDisplay_Timestamp() function."); | |
$aDT = explode(' ', $sDT); | |
if(count($aDT) != 2) | |
fnErr("Invalid parameter passed to fnDisplay_Timestamp() function."); | |
$sDate = $aDT[0]; | |
$sDate = substr($sDate, 5, 2).'/'.substr($sDate, 8, 2).'/'.substr($sDate, 0, 4); | |
return $sDate; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment