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
EVALUATE(newDate,COPYSTR(FORMAT(RecField,0,'<Day,2>/<Month,2>/<Year4>'),1,2));
RecField.VALUE(newDate);
END;
Can anyone help me to solve this problem? Thank you
0
Answers
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.
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.