Solved

Convert a data calculation into a string

Posted on 2013-11-26
4
375 Views
Last Modified: 2013-11-26
I am taking the planned start/end dates and actual start/end dates and calculating the variance and I am ending up with results like 3.00:00:00.  I'd like to convert it to an integer or string so I can add "days" after it.  Formatting the textbox to a number doesn't help.  I tried Cint() but that didn't work either.  Can anyone tell me how to convert 3.00:00:00 into 3 please?

MS VS 2010
MS SQL Server 2008 R2

= ReportItems!ActualStartDate.Value - ReportItems!PlannedStartDate.Value

Open in new window

= CDate(ReportItems!PlannedEndDate.Value) - Cdate(ReportItems!ActualEndDate.Value)

Open in new window

0
Comment
Question by:HSI_guelph
  • 3
4 Comments
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
Give this a whirl..
=DateDiff("d", ReportItems!ActualStartDate.Value, ReportItems!PlannedStartDate.Value)

Open in new window

0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
Comment Utility
... and making it a string...
=CStr(DateDiff("d", ReportItems!ActualStartDate.Value, ReportItems!PlannedStartDate.Value)) + " days"

Open in new window

0
 

Author Closing Comment

by:HSI_guelph
Comment Utility
@jimhorn - the first one gave me (3), lol.  The second one gave me -3 days so maybe if I switch the order I can get a positive number.  

Swapping the items gave me 3 days.  Thank you very much!!
0
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
Thanks for the grade.  Have fun doing SSRS expressions.  -Jim
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now