Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: formula to calculate interval between dates Post Reply Post New Topic
Author Message
pfheg67
Newbie
Newbie
Avatar

Joined: 13 Feb 2009
Location: United States
Online Status: Offline
Posts: 5
Quote pfheg67 Replybullet Topic: formula to calculate interval between dates
     Posted: 23 Feb 2009 at 1:59pm
i am trying to write a formula to calculate how long a ticket has been opened.  ex: received date - closed date
 
the problem is the fields are setup as strings so i can't do a simple datediff or a simple formula to subtract both field.
 
do i need to convert them first to a date field?  new user and struggling with getting this to work.
 
any help would be appreciated.
Patrick
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Feb 2009 at 2:47pm
Yes you should convert them to a date field and also use the date diff at the same time.
Not sure what your date strings look like so I cannot tell you how to convert them but one option would be something like:
datediff("d",cdate({table.receiveddatefield}),cdate({table.closedatefield}))
 
Note that this is checking for the number of days between the 2 dates (the "d" in the datediff). If you need a different interval change it accordingly.


Edited by DBlank - 23 Feb 2009 at 2:48pm
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum