How to Convert SQL Date Format to Crystal Reports Date Format

Possible Resolutions

Resolution #1

  1. Use pwFormatDate formula in Crystal Reports
  2. pwFormatDate(xxx)

Resolution #2

Local NumberVar input := {BKTRANH.TRANSDATE}; // use your field name
// This line checks for a minimum value, any value will work.
If input < 19500101
then Date (0,0,0) else
Date(Picture(ToText(input,0,””),”xxxx/xx/xx”))

  • Due to our fonts on our website, you might need to remove and manually add back the double ” and single ‘ quotes in the formula

Resolution #3

  • This formula is for converting dates stored in the 8-digit numeric format, YYYYMMDD
  • Due to our fonts on our website, you might need to remove and manually add back the double ” and single ‘ quotes in the formula

Local NumberVar y := {Table.NumericDate}; // use your field name
Local StringVar z := Totext (y, 0,””);
z := Picture (z, ‘xxxx-xx-xx’);
If IsDate (z)
then DateValue(z)

Resolution #4

  • This formula is for converting dates stored in the 6-digit numeric format, YYMMDD
  • Due to our fonts on our website, you might need to remove and manually add back the double ” and single ‘ quotes in the formula

Local NumberVar y := {Table.NumericDate}; // use your field name
Local StringVar z := Totext (y, 0,””);
z := Picture (z, ‘xx-xx-xx’);
If IsDate (z)
then DateValue(z)