I don't know why you are getting an error message. You stated that you are getting the output mm/dd/yyyy. The code parses your date to give you the first two tokens, using your stated / as a delimiter that means it would set %? as mm i.e. 11 which as you know doesn't have a leading 0. However, as you will note by my code, to prevent an error of the type you are getting I have already built in a fix. When your run the code in March, the %? variable would be 03. In order to remove any leading 0, I prefix a 1 thus making it 103 then subtract 100 making it read 3! SET/A would therefore never see a figure with a leading 0.