Re: Datetime stored in bigint

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Cc: pgsql-novice(at)postgresql(dot)org Content-Type: multipart/alternative; boundary=bcaec51ba3f99bcecf04a8ea376e X-Virus-Scanned: Maia Mailguard 1(dot)0(dot)1 X-Mailing-List: pgsql-novice List-Archive: <http://archives(dot)postgresql(dot)org/pgsql-novice> List-Help: <mailto:majordomo(at)postgresql(dot)org?body=help> List-ID: <pgsql-novice(dot)postgresql(dot)org> List-Owner: <mailto:pgsql-novice-owner(at)postgresql(dot)org> List-Post: <mailto:pgsql-novice(at)postgresql(dot)org> List-Subscribe: <mailto:majordomo(at)postgresql(dot)org?body=sub%20pgsql-novice> List-Unsubscrdev ss <ssdev938(at)gmail(dot)com>
Subject: Re: Datetime stored in bigint
Date: 2011-08-09 01:10:19
Message-ID: d5ada6b01dca89f08ed249c4a0714070@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> Thanks for your help in converting the bigint to date format using
> function but is there a way to run a SQL query to show all the fields in the
> database.

It's not clear what you are asking but I will give it a try.

> Example as below in database it stores as below
>
> documentid patientname datetime
> Z549909343 Test, Test 634459985818906250
> Y225220522 Test1,Test 634469467411401690
>
> I need to run a query to show values as below instead of single values
> documentid patientname date
> Z549909343 Test, Test 2011-07-11 16:29:00
> Y225220522 Test1,Test 2011-07-22 15:52:00

Perhaps create the function I gave before, then run:

SELECT documentid, patientname,
yearzero_to_timestamp(datetime) AS date
FROM yourtable;

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201108082109
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAk5AiOEACgkQvJuQZxSWSsgA4gCbBOfK4yOejfSn01S1utFOOmoT
l04AnRSDXtq4E8DOFPbhUyNEh6W9shW7
=U75j
-----END PGP SIGNATURE-----

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Lille Penguini 2011-08-10 01:49:11 how do I add postgis to an existing postgresql install?
Previous Message Merlin Moncure 2011-08-08 22:14:54 Re: Moving a PostgreSQL database to a new tablespace