[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 800
  • 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 ???

0
billyleo
Asked:
billyleo
1 Solution
 
jorgesv13Commented:
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)
0
 
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)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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