Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2049
  • Last Modified:

Convert Float to Time Stamp with No Date and must return days as hours - URGENT

I have field in a table which is Float, it contains a Duration Value.
I need this to be returned as a Time Value.

For Example I can get it to return as a TIme Stamp....as Below using 108 or 114
which gives me HH:MM:SS:mmm

select convert(Varchar,CAST(NetDur AS DATETIME),108)as NetDur
From
CliSpend

Result looks like : 00:11:27:997

But if I look at this value using
select convert(Varchar,CAST(NetDur AS DATETIME),120)as NetDur
From
CliSpend

Result looks like : 1900-01-03 00:11:27

So actually my duration is 3 days, eleven mins and twenty seven seconds.....

I need my time stamp to then include the number of days in hours....
so it should be 72 hours.....

I need the result to be 72:11:27:997
This value as float is displayed as 2.00796296296296 of which I've attempted my convert on.

Please can someone help this is URGENT.

0
EHardie
Asked:
EHardie
  • 2
  • 2
1 Solution
 
Patrick MatthewsCommented:
EHardie said:
>>I need the result to be 72:11:27:997

Based on your example, shouldn't that be 48:11:27:997?  After all, it looks like scant more than *2* days
have passed...

Regards,

Patrick
0
 
EHardieAuthor Commented:
Ok possibly I'm just assuming as imy other results are
1900-01-01 00:00:00 for example so  assumed 3 days.....for the 3rd of the month.
Either way I'm just trying to achieve the hours to reflect yes such as 48 hours or 72 hours so the time is presented to add on 24 hours per day ......

Any idea's ?
0
 
Patrick MatthewsCommented:
SELECT CONVERT(varchar, DATEDIFF(hour, '1900-01-01', CONVERT(datetime, NetDur))) + SUBSTRING(CONVERT(varchar, CONVERT(datetime, NetDur), 114), 3, 10)
FROM CliSpend
0
 
EHardieAuthor Commented:
You rock , thanks
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now