Solved

Convert a data calculation into a string

Posted on 2013-11-26
4
377 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
ID: 39678361
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
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 65

Expert Comment

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

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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