• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 902
  • Last Modified:

MM-YY Convert to DD-MM-YYYY ie. make credit card expiry date into a datetime

Anyone know how to make my MMYY value eg: 0708 into a datetime variable DDMMYYYY eg: 31072008 ???

1 Solution
You have to create a new DateTime object and pass it the year and month to the constructor

            Dim myDate As New DateTime(2008, 7, 31)
Christopher KileCommented:
Sure :)
dim monthYearString = "0708"
dim dayString = "20"
Dim centuryString = "20"
Dim datetimeVar as DateTime = DateTime.Parse(centuryString & monthYearString.Substring(2, 2) & "/" & monthYearString.Substring(0, 2) & "/" & dayString)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now