how to convert float to timestamp in single select query

  • 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. 26:11:00

  • mauliks1990 (3/18/2015)


    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. 26:11:00

    26:11:00 is not a valid time. If you haven't noticed yet, there are only 24 hours in a day.

    To format it with the days seperately:

    DECLARE @dectime float = 1.251152515236;

    SELECT CONCAT(FLOOR(@dectime),' days ',CONVERT(TIME(0),DATEADD(SECOND,(@dectime - FLOOR(@dectime)) * 86400,0)

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply