Re: how to convert float to timestamp in single select query

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Maulik Shah <mauliks(at)rosconsultancy(dot)in>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to convert float to timestamp in single select query
Date: 2015-04-01 06:51:30
Message-ID: CAKFQuwZUwkrFPus_8qiPuPYVBLz=X2C6d=wF2y=3j=mSmJv83g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Mar 29, 2015 at 8:52 PM, Maulik Shah <mauliks(at)rosconsultancy(dot)in>
wrote:

> Dear Sir/Madam
>
>
> how to convert float to timestamp in single select query
>
> for exp. i have float as 1.251152515236 ,
>
> i want to convert this to datetime and from datetime to timestamp...
> i.e. 02:22:044456
>

​You imply that (float) 1.251152515236 is equal to (time) 02:22:044456​

I have no clue what formula: f(x) = ?x? would satisfy f(1.251152515236) =
'02:22:044456'::time

Once you answer that you can either inline said formula or create a
user-defined function to encapsulate it. See the documentation for the how.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexey Bashtanov 2015-04-01 06:56:35 How to diagnose max_locks_per_transaction is about to be exhausted?
Previous Message Tom Lane 2015-04-01 04:17:14 Re: Would like to know how analyze works technically