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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date-Time Format

Status
Not open for further replies.

ddnh

Programmer
Nov 25, 2002
94
US
I'm trying to write a formula for a date field. If 1/1/1900 is entered, then nothing should be displayed. Any other date should be displayed.

When I tried the following (the value displayed on the report before using the formula)

If {Date} = 1/1/1900 then
" "
else
{Date}


I got an error saying a date-time is required right before the date.

When I tried the following (the value in query analyzer if I execute the stored procedure)

If {Date} = 1900-01-01 00:00:00 then
" "
else
{Date}

It says the keyword 'then' is missing.

When I tried the following

IF ToText({Date},'MM/dd/yyyy') = '01/01/1900' then
""
Else
{Date}

It says 'a string is required here' right before the date field after the else.

Any suggestions?
 
Hi !

If you use your last example and change it like this I think it shall work:

IF ToText({Date},'MM/dd/yyyy') = '01/01/1900' then
""
Else
ToText({Date},'MM/dd/yyyy')


/Goran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top