I'm trying to write a script to do a calcuation of expiration date inside a label.
The data file (.bt) file I'm provided with has the MfgDate and the shelf life in months on it. The fields are strings. The calculation is MfgDate + Shelf life in months = Expiration date. The Expiration date will be printed on the label.
When trying to use multi-line script I'm lost. I can't seem to get the value of the field into a variable to manipulate.
This will get the value of the field on the label so I know the field is populated with a valid date string.
Since I know it's a string, I need to parse the date out of it for the calculation. The date happens to be in the format of MM/DD/YYYY
If I type in something like "2023-04-26" then CDate works fine! Why can't CDate parse the date out of my field?
ultimately, I need to extract the date, add the months to it with the DateAdd function and then format it back to a format I can use such as nQYY where N is the quarter, 'Q' is the literal character Q and then YY is the two digit year. Something like 2Q33 for second quarter 2033 as expiration.
Please sign in to leave a comment.