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

Posted on 2008-11-14
Last Modified: 2012-05-05
Anyone know how to make my MMYY value eg: 0708 into a datetime variable DDMMYYYY eg: 31072008 ???

Question by:billyleo
    LVL 8

    Expert Comment

    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)
    LVL 23

    Accepted Solution

    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)

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video discusses moving either the default database or any database to a new volume.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now