Crystal Reports – How to convert text date to datetime format

Text of dates in Crystal Reports can be annoying – you can’t apply any date-specific formatting or use the date in formulas – because it is after all, just the text of the date.

The alternative is a proper date field – but how do you convert that text date to a proper date field?

Method 1: DateValue

The formula below shows how to use the DateValue function to convert text to a real date field.

DateValue will automatically convert the text to a date field IF the format matches the system format.

For example 30/12/2018 would need only work if the system format was dd/MM/yyyy

DateValue( {Date_String} )

Method 2: cDate

If DateValue doesn’t work you can force the date format using the cDate function.

The example below shows how to do this for dd/MM/yyyy format – you will likely need to change this to match your date format.

cDate( ToText( cDate( {Date_String} ), "dd/MM/yyyy" )  )