[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Convert a data calculation into a string

Posted on 2013-11-26
4
Medium Priority
?
395 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 66

Expert Comment

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

Open in new window

0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 39678373
... 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
ID: 39678538
@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 66

Expert Comment

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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

872 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