Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
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
PGP Key: 0x14964AC8 201108082109


In response to

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group