Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: ANYBODY?!! Time comparison in crystal - help..! Post Reply Post New Topic
Author Message
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Topic: ANYBODY?!! Time comparison in crystal - help..!
    Posted: 08 Jul 2010 at 12:33am
Ok so I have two time fields CreateTime and STATTME.
These fields appear as example 08:55 42 and 09:12 32
I want to create a new field which gives me the time difference between the two.
I thought I could just do it like
 

DateDiff ("n", {@CreateTime}, {@STATTME})
 
I get an error message saying a date is required here.
Is this because of the way my time is formatted?
Anyone know of anyway around this?
I'm new to crystal and any help would be greatly appreciated.


Edited by colman1212 - 08 Jul 2010 at 1:22am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Jul 2010 at 3:16am
add a generic date to each time field and then use the datdiff formula you had:
DateDiff ("n", currentdate+{@CreateTime}, currentdate+{@STATTME})
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 08 Jul 2010 at 3:53am
Originally posted by DBlank

add a generic date to each time field and then use the datdiff formula you had:
DateDiff ("n", currentdate+{@CreateTime}, currentdate+{@STATTME})
 
Thanks but no luck.
I literally just changed my formula to what you have there and I'm still getting the same error.
'There is an error in your formula, do you wish to save anyway?'
and then it highlights {@CreateTimeand says a number is required here.... Any other ideas?
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Jul 2010 at 3:55am
What is your "CreateTime" formula?
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 08 Jul 2010 at 3:57am
Originally posted by DBlank

What is your "CreateTime" formula?
 
HelpDeskTimeToTimeString({TABLE1.TIME})
 
Time is stored like '13670947600' and that converts it to 08:38:05


Edited by colman1212 - 08 Jul 2010 at 4:01am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Jul 2010 at 4:00am
I assumed it was still a time field not a string...
if it is originally a time field just use it without the formula
DateDiff ("n", currentdate+{Table1.Time}, currentdate+{table1.stattime})
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 08 Jul 2010 at 4:02am
Originally posted by DBlank

I assumed it was still a time field not a string...
if it is originally a time field just use it without the formula
DateDiff ("n", currentdate+{Table1.Time}, currentdate+{table1.stattime})
 
Time is stored like '13670947600' and that converts it to 08:38:05
So its not a time field originally unfortunatley :-( ....Hmmmmmm......
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Jul 2010 at 4:05am
try
DateDiff ("n", currentdate+time({@CreateTime}), currentdate+time({@STATTME}))
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 08 Jul 2010 at 4:09am
Originally posted by DBlank

try
DateDiff ("n", currentdate+time({@CreateTime}), currentdate+time({@STATTME}))
 
Legend! Thanks a million, much appreciated!!!!!!
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.