Обсуждение: how to convert float to timestamp in single select query
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 I need sql query It is actually .crd file made in xml , and i have query inside xml like <![CDATA[ SELECT USER.LastName, USER.fltime from Tbalname ]> fltime has float value which i need to convert to time Regards Maulik Shah
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.
On 03/29/2015 08:52 PM, Maulik Shah wrote: > Dear Sir/Madam > > > how to convert float to timestamp in single select query > > for exp. i have float as 1.251152515236 , test=> select to_timestamp(1.251152515236); to_timestamp ------------------------------- 1969-12-31 16:00:01.251153-08 The above assumes your value is seconds since epoch, which I am pretty sure is not the case here. > > i want to convert this to datetime and from datetime to timestamp... > i.e. 02:22:044456 Well the above is a time not a datetime or timestamp, so I am not really sure what you are after? In other words more context is needed about where the value is coming from and what other information is available to anchor it to a datetime. > > I need sql query > > > It is actually .crd file made in xml , and i have query inside xml like > > > <![CDATA[ > SELECT USER.LastName, USER.fltime from Tbalname > > > ]> > > > > fltime has float value which i need to convert to time > > > Regards > Maulik Shah > > -- Adrian Klaver adrian.klaver@aklaver.com