Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turning Seconds in DD:HH:MM:SS

Status
Not open for further replies.

mbryantuk

Programmer
Aug 3, 2007
29
GB
Hi

Can someone help me turn the difference between a start date/time and end date/time into seconds in the format of DD:HH:MM:SS in my Reports

Thanks

Matt
 
This is pretty nasty. I'd suggest putting the calculation into a custom assembly deployed to your report server for increased maintainability. I also have an FAQ in forum183 about how to do this in T-SQL.

Code:
= iif(Fields!sec.Value > 86400, ((Fields!sec.Value - (Fields!sec.Value mod 86400))/ 86400).ToString() & ":", "")
	+ Right("00" + (((Fields!sec.Value mod 86400) - (Fields!sec.Value mod 3600)) / 3600).ToString(), 2) + ":"
	+ Right("00" + (((Fields!sec.Value mod 3600)-(Fields!sec.Value mod 60)) / 60).ToString(), 2) + ":"
	+ Right("00" + (Fields!sec.Value mod 60).ToString(), 2)

Hope it helps,

Alex

[small]----signature below----[/small]
Majority rule don't work in mental institutions

My Crummy Web Page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top