Re: Datetime stored in bigint - Mailing list pgsql-novice

From Greg Sabino Mullane
Subject Re: Datetime stored in bigint
Date
Msg-id d5ada6b01dca89f08ed249c4a0714070@biglumber.com
Whole thread Raw
In response to Re: Datetime stored in bigint  (dev ss <ssdev938@gmail.com>)
List 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@turnstep.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-----



pgsql-novice by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Moving a PostgreSQL database to a new tablespace
Next
From: Lille Penguini
Date:
Subject: how do I add postgis to an existing postgresql install?