Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Time date feilds Post Reply Post New Topic
Author Message
tazib
Newbie
Newbie
Avatar

Joined: 19 Oct 2007
Location: United Kingdom
Online Status: Offline
Posts: 7
Quote tazib Replybullet Topic: Time date feilds
     Posted: 30 Jan 2008 at 6:02am
Hi I was wondering if anyone can help me? I have a date feild such as :-
 
{date of fault} and a time feild {time of fault} I want to join these two together and subtract them from {date of resolution} and {time of resolution}
 
so by joining the feilds and subtracting them is this possible????
and how can this be done??
 
currently in crystal the feilds as mentioned above are string feilds so I would have to convert them
 
please help anyone its killing me
 
AngryDead
 
I am using crystal version 8.5


Edited by tazib - 30 Jan 2008 at 8:18am
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 30 Jan 2008 at 8:59am
CDateTime() converts a string to a date time variable. Just make sure to put a space between your two strings when you concatenate them together and pass it to the function.

I have all the Crystal Reports functions documented with sample code in my book.  Crystal Reports Encyclopedia
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
tazib
Newbie
Newbie
Avatar

Joined: 19 Oct 2007
Location: United Kingdom
Online Status: Offline
Posts: 7
Quote tazib Replybullet Posted: 30 Jan 2008 at 9:03am
Once they are converted I assume there is a function to covert a string feild into a time aswell?
 
how do i concatenate them and then subtract them to minus one date time feild from another??
 
kind regards
 
Taz
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 31 Jan 2008 at 7:43am
First, concatenate them as strings:

{date of fault} & " " & {time of fault}

Then, do your conversion:

CDateTime( {date of fault} & " " & {time of fault} )

Do the same thing with your resolution fields.  Then, they are both datetime fields, and can be compared normally.


IP IP Logged
gscott
Newbie
Newbie
Avatar

Joined: 05 Feb 2008
Online Status: Offline
Posts: 3
Quote gscott Replybullet Posted: 05 Feb 2008 at 10:32am
Hello,
I'm new to crystal XI and wanted to know if anyone has been able to remove the time from a crystal report when exporting to disk the current value for DATETIME = %SI_STARTTIME%. This also creates the time
question is anyway to just get the date without the time?
gscott
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 06 Feb 2008 at 5:10am
The CDate function will convert a datetime value into just a date value.  That's probably the simplest solution.


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