Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to print an empty date/time field

Status
Not open for further replies.

yoink

Programmer
Dec 2, 2001
15
AU
Hi guys,

I've got a report which gets some alarm date/time values from a database. These values are in the format "dd/mm/yyyy hh:mm:ss".

I'd like to print a blank space " " if the date/time value in the database is 0. Having not used crystal much before, I thought this would be easy. However, for some unknown reason it's forcing me to have a date/time output since I'm checking the status of a date/time field. Here's my code:

IF {AlarmTime} > Date (1970,01 ,01 ) THEN {AlarmTime}
ELSE Date(0,0,0)

This works okay for the date part, but instead of printing a blank space, it prints out "0:00:00". I can't just format the formula field and suppress the time, because I need it to appear when a valid date actually exists.

Can anyone suggest a way I can get around this?

Andrew
 
Never mind, I worked it out:

IF (InStr ((ToText({AlarmTime})),"1/01/70")) > 0 THEN " "
ELSE ToText({AlarmTime});
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top