cancel
Showing results for 
Search instead for 
Did you mean: 

String to Date formula

Former Member
0 Kudos

Post Author: llcoolt

CA Forum: Formula

Hey all!

I have a string field "UDWARHOUSE.WELCOMELETTER" that is used for dates. In order to bring it into my report with a date I used this formula, called "DateLetter":

DateValue ({UDWARHOUSE.WELCOMELETTER})

Works fine until I want to determine the number of days between the string field "UDWARHOUSE.WELCOMELETTER" and a date field "HOUSEMASTER.SETTLEMENT_DATE".

I wrote this formula to accomplish the task:

({@DateLetter}) - {HOUSEMASTER.SETTLEMENT_DATE}

It seems to work fine and returns the day expected until I refresh the report.

Any thoughts on where I'm going wrong?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Post Author: V361

CA Forum: Formula

Try CDATE

Examples

The following examples are applicable to both Basic and Crystal syntax:

CDate ("Dec. 31, 1999")

Returns the Date value for Dec. 31, 1999.

CDate (50)

Returns the Date value for February 18, 1900.

CDate (#Oct. 20, 1999 12:02pm#)

Returns the Date value for October 20, 1999.

CDate (1930, 7, 30)

Returns the Date value for July 30, 1930.

Comments

You can use the IsDate function to check if a String argument can be converted to a Date before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.