Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: DateTimeDiff alternative 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: DateTimeDiff alternative
     Posted: 04 Oct 2010 at 5:43am
Hi Folks,
 
I just opened up an old crystal report and got an error saying:
'UFL 'u2ldtdif.dll' that implements this function is missing.'
 
It seems that the below function (DateTimeDiff) is stored in that dll file.
Is there another function I could use which would do the same thing?
 
StringVar TimeSinceBreach := DateTimeDiff(ExpiryDateTime,CurrentDateTime);
 
Any help would be very much appreciated.
 
Thanks,
Colman


Edited by colman1212 - 04 Oct 2010 at 5:44am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Oct 2010 at 8:56am

unless you can tease it out by looking at where this is being used in the report it is hard to say.

My guess is that this is a string that displays as 'x hours and x minutes' the time difference between an expected completion datetime field in your DB and the current date and time.
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 04 Oct 2010 at 10:37pm
Originally posted by DBlank

unless you can tease it out by looking at where this is being used in the report it is hard to say.

My guess is that this is a string that displays as 'x hours and x minutes' the time difference between an expected completion datetime field in your DB and the current date and time.
 
Yeah I think you are right but is there any function I can use to replace it?
so basically this is the whole formula
 
//This formula is designed to calculate the time passed since the call expiry date

DateTimeVar ExpiryDateTime := DateTime ({@Expiry Date},{@Expiry Time});                          //ExpiryDateTime = ExpiryDate, ExpiryTime
 
StringVar TimeSinceBreach := DateTimeDiff(ExpiryDateTime,CurrentDateTime);                    //returning value = Time Since Call Breach = Difference between ExpiryDate (above) and CurrentDateTime
 
NumberVar MinPos := InStr (1,TimeSinceBreach ,"Minute(s)" );                                            //Restrict the returned string to minutes
 
Mid (TimeSinceBreach,1 ,MinPos + 8 )
 
I basically want to know how to find the difference between two date times.
 
 
 


Edited by colman1212 - 05 Oct 2010 at 12:30am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Oct 2010 at 4:04am
you can get the time difference using datediff('x',start,end)
where x is the interval you want to chack for and the start and end are the datetime fiells you want to calculate on.
you will likely be
datediff('n',{@expirydate},currentdatetime)
this will give you the total minutes
then you can create a formula to convert the total minutes into whatever display you want.
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 06 Oct 2010 at 10:56pm
Originally posted by DBlank

you can get the time difference using datediff('x',start,end)
where x is the interval you want to chack for and the start and end are the datetime fiells you want to calculate on.
you will likely be
datediff('n',{@expirydate},currentdatetime)
this will give you the total minutes
then you can create a formula to convert the total minutes into whatever display you want.
 
Great, thanks a million, thats actually working for me. Do you know what formula I could use to convert the minutes into days hours minutes.
Basically I want it to say something like 2 days 1 hour 4 mins
IP IP Logged
colman1212
Newbie
Newbie


Joined: 08 Jul 2010
Location: Ireland
Online Status: Offline
Posts: 36
Quote colman1212 Replybullet Posted: 06 Oct 2010 at 11:22pm
actually never mind, I got it. For anyone else that wants to know, this is how its done:
 
WhilePrintingRecords;
NumberVar TotalSec :=  {Warehouse.Duration};
NumberVar Days    := Truncate  (TotalSec / 86400);
NumberVar Hours   := Truncate  (Remainder ( TotalSec , 86400) / 3600) ;
NumberVar Minutes := Truncate  (Remainder ( TotalSec , 3600) / 60) ;

Totext ( Days ,    '##' ) +  ' Days, ' +
Totext ( Hours ,   '##' ) +  ' Hrs, and ' +
Totext ( Minutes , '##' ) +  ' Mins'
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