#native_company# #native_desc#

PostgreSQL date converter

By Robert Treat
on April 23, 2001

Version: 0.99.1

Type: Function

Category: Calendars/Dates

License: GNU General Public License

Description: This converts PostgresSQL date_timestamps to something PHP can work with. The time part was giing me trouble (it was way off) so I left it out. The function still has a place for it, I just left the formatting out.

function pg_date($pgtimestamp){
    $Date_Time = explode(" ", $pgtimestamp);
    $date_pieces = explode("-", $Date_Time[0]);
    $time_convert = explode("-", $Date_Time[1]); // strip the tz offset from time
    $time_pieces = explode(":", $time_convert[0]);
    $timestamp = mktime($time_pieces[0], $time_pieces[1], $time_pieces[2], $date_pieces[1], $date_p
ieces[2], $date_pieces[0]);

    return date("F j, Y, g:i a", $timestamp);