Date format DDMMYYYY and use as Date data type

I need to format the date into DDMMYYY. But want to use as Date, not a text.
This gives me correct formate FORMAT(TODAY,0,'<Day,2>/<Month,2>/<Year4>'); but want to assign to date, when used EVALUATE again my date become DDMMYY.

I am using RecRef therefore need to use same date formate

IF (TableID = 271) AND (BankMapRec."Field No." = 4) THEN BEGIN


Can anyone help me to solve this problem? Thank you


  • kylehardinkylehardin Member Posts: 257
    Separate the FORMAT from the EVALUATE - do it in two steps, and that way you can figure out what's going on in the debugger.

    TempText := COPYSTR(FORMAT(RecField,0,'<Day,2>/<Month,2>/<Year4>'),1,2);
    EVALUATE(newDate, TempText);

    Make sure TempText is what you expect it to be.
    Kyle Hardin - ArcherPoint
  • shanabeywicremashanabeywicrema Member Posts: 53
    But when I assign to date type again it shows 07/04/20 instead of 07/04/2020
  • kylehardinkylehardin Member Posts: 257
    Maybe post your whole block of code.

    It sounds like you are confusing the initial FORMAT which converts the date in RecField into text, and the final output you want in newDate, which is a date that used EVALUATE to turn the text into a date.

    Once you have a valid date in newDate, you will need a second - independent - FORMAT statement to make it look like whatever you want.
    Kyle Hardin - ArcherPoint
Sign In or Register to comment.