I'm trying to write a function that validates the expiration date and compares it to today's date.
Then if today's date is passed the expiration date, flips a flag to mark it expired.
Here's what I have so far.
Credit Card Expiration Date(OnValidate)
D := TODAY;
Day := DATE2DMY(D,1);
Month := DATE2DMY(D,2);
Year := DATE2DMY(D,3);
IF (Text001) > "Credit Card Expiration Date" THEN BEGIN
Expired := TRUE
Modify(TRUE);
END;
Text001 = %2/%3
I realized it was trying to divide these values, so I'm not sure how to calculate this.
0
Comments
Just do:
If however it is a text field, only containing the month and year then you are on the right track. Use some code to separate out the month and year from Credit Card Expiration Date (Hint: STRPOS to find the separator, and COPYSTR to get the substring). Now you have two months and two years to compare with each other. Don't forget that you may have to account for instances where the date was put in as both 11 and 2011 for example, and the month as 01 and 1.
My Blog - nav.education
I think we may go a different route with this, but I've jotted this down.