Solved

Expression for converting seconds to Hours and Minutes in SQL Reporting

Posted on 2008-10-06
3
888 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
  • 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 125 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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