Technical Questions
 Crystal Reports Forum : Crystal Reports 9, X, XI, 2008, 2011 : Technical Questions
Message Icon Topic: Truncate/Clipping a datetime field Post Reply Post New Topic
Author Message
KopiteJay
Newbie
Newbie
Avatar

Joined: 15 Sep 2008
Location: United Kingdom
Online Status: Offline
Posts: 11
Quote KopiteJay Replybullet Topic: Truncate/Clipping a datetime field
    Posted: 01 Oct 2008 at 2:49am
Hello,

Firstly, I have a date/time field coming over from sql which outputs something similar to the following:

26/09/2008 00:00:00

I am using this field within a formula that involves some text, and this date/time field. e.g.

'Your next appointment is on ' & {event.date} & '. Please call us ............ etc etc

I would like to chop off the time section to just leave the date. I keep finding how to do it if it were a string but not with this date/time field.

Secondly, is it possible within a formula to force a carriage return so text continues the next line down? I have a few lines of text with some fields within them. Certain parts I want to appear on the next line.

Many thanks in advance. As someone new to Crystal I am very grateful for any help.

Cheers,

Jason


Edited by KopiteJay - 01 Oct 2008 at 6:46am
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 01 Oct 2008 at 7:43am
The Totext function can be used to convert a date to a string.  Look at the help file for Totext to see how it works.  You can make another formula field called displaydate (or whatever)  and use
 
Totext ({event.date},"MMM d, yyyy")
 
Then make your string say
 
'Your next appointment is on ' & {@displaydate} & '. Please call us ............ etc etc
 
If you are not sure if the date field is really a date, you might want to first use the ISDATE function.  That returns a boolean to tell you if the date field is a valid date. 
 
I don't know about forcing a carriage return.
 
Good luck.


Edited by JohnT - 01 Oct 2008 at 7:47am
IP IP Logged
KopiteJay
Newbie
Newbie
Avatar

Joined: 15 Sep 2008
Location: United Kingdom
Online Status: Offline
Posts: 11
Quote KopiteJay Replybullet Posted: 02 Oct 2008 at 3:34am
Thankyou very much for that. Got it working with what you said.

Cheers.
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.094 seconds.

FREE ADVANCED
Crystal Reports Training!

Plus, free bonus PDF cheat sheet! Advanced Crystal Reports Training Give Me Advanced Training!