Print Page | Close Window

Subtracting Two Dates in the same field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16677
Printed Date: 03 May 2024 at 1:49am


Topic: Subtracting Two Dates in the same field
Posted By: KMendels
Subject: Subtracting Two Dates in the same field
Date Posted: 05 Jun 2012 at 9:57am
Easy part - I would like to subtact two dates from each other to see how many days have elapsed between the two dates.
 
Hard part - these two dates belong to the same field.  DateDiff seems to require two different fields to subtract.
 
Example:
 
Case #     Code    Date 3
FSP1        A105    4/16/2012
FSP1        A110    4/22/2012
 
How can I subtract the 4/16/2012 value from the 4/22/2012 value?



Replies:
Posted By: DBlank
Date Posted: 05 Jun 2012 at 10:10am
datediff('d',{table.date3},next({table.date3}))


Posted By: KMendels
Date Posted: 05 Jun 2012 at 10:29am
Perfect!  Thank you!!!



Print Page | Close Window