?
Solved

Expression for converting seconds to Hours and Minutes in SQL Reporting

Posted on 2008-10-06
3
Medium Priority
?
906 Views
Last Modified: 2010-04-21
Hi all,

Running SQL 2005 Reporting Services.  I have a field in my report that shows total seconds.  I would like to show that value as hours and minutes (ie 3:05 for 3 hours 5 minutes).  Right now I have this expression:
=(Fields!TIMEINSECONDS.Value)\60) \60 & ":" & (Fields!TIMEINSECONDS.Value)\60) \60) \60

But this shows as 3:5

Is there a better expression to accurately get what I want?
0
Comment
Question by:ckangas7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Expert Comment

by:srivatsavaye
ID: 22674149
Hi,

I think you have to write a simple VB.NET function to return the string.
0
 
LVL 9

Accepted Solution

by:
srivatsavaye earned 500 total points
ID: 22674332
here is the expression that returns what you want

=Fields!secs.Value\60 \60 & ":" & iif((Fields!secs.Value mod 3600)\60 > 9, (Fields!secs.Value mod 3600)\60, "0" & (Fields!secs.Value mod 3600)\60)
0
 

Author Closing Comment

by:ckangas7
ID: 31503607
Awesome.  Thanks.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1. Set up your parameter at the report level as usual, check the box Multi-value, and set the Data Type to String 2. Set the Stored Procedure Parameter to varchar(max)  --<---- This part here is the key to it's success Example:    @cst_key var…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question