Re: how to convert float to timestamp in single select query - Mailing list pgsql-general

From David G. Johnston
Subject Re: how to convert float to timestamp in single select query
Date
Msg-id CAKFQuwZUwkrFPus_8qiPuPYVBLz=X2C6d=wF2y=3j=mSmJv83g@mail.gmail.com
Whole thread Raw
In response to how to convert float to timestamp in single select query  (Maulik Shah <mauliks@rosconsultancy.in>)
List pgsql-general
On Sun, Mar 29, 2015 at 8:52 PM, Maulik Shah <mauliks@rosconsultancy.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.

pgsql-general by date:

Previous
From: Maulik Shah
Date:
Subject: how to convert float to timestamp in single select query
Next
From: Alexey Bashtanov
Date:
Subject: How to diagnose max_locks_per_transaction is about to be exhausted?