Solved

Convert a data calculation into a string

Posted on 2013-11-26
4
379 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
[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
  • 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
point in time restore in SQL server 26 53
SSRS 2016 Parameter Search on a long list id 8 43
Need to trim my database size 9 52
2008 to 2016 jump (SQL Server) 1 31
In this article I will describe the Backup & Restore 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.
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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