Convert Date.. how?

1. Junior Member
Join Date
Dec 1969
Posts
14

## Convert Date.. how?

I have been having problems trying to convert the date from a credit card expiration date into a different format needed for a billing software...<BR><BR>I need to convert from the expiration drop down of<BR><BR>(mm/yy) to (mm/dd/yy) e.g. 11/03 needs to be 11/30/03<BR><BR>Any suggestions and/or help would greatly be appreciated!!<BR><BR>Thanks for your time

2. Senior Member
Join Date
Dec 1969
Posts
549

## RE: Convert Date.. how?

Given that &#039;intMonth&#039; and &#039;intYear&#039; are taken from your form (and that you&#039;re on a server set to US date/time) I think this will probably work:<BR><BR>datExpires = cdate(intMonth & "/01/" & intYear)<BR>datExpires = DateAdd("m", 1, datExpires) &#039; Add one month<BR>datExpires = DateAdd("d", -1, datExpires) &#039; Subtract one day<BR>

3. Senior Member
Join Date
Dec 1969
Posts
1,913

## With a bit of cunning ....

OK, the way I would do it is to use DateAdd.<BR><BR>As you know the month and the year, you can then determine the last day of the month with a bit of cunning.<BR><BR>1) Get the month and year into variables called TheMonth & TheYear<BR>2) Pretend that it is the first of the month<BR>3) Add one month to the date and then subtract one day.<BR>4) You now have a date which holds the last day of the previous month.<BR><BR>And you can do that all in one line :)<BR><BR>TheExpiryDate = DateAdd("d",-1,DateAdd("m",TheMonth & "/01/" & TheYear)<BR><BR>This will work out leap years etc. for you as well.

4. Junior Member
Join Date
Dec 1969
Posts
14

## Jerome and Eddy THANKS!!!!!!!!!!!! (nt)

THANK YOU THANK YOU!!!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•