Check short date format of local machine from within VB
Posted on 2001-06-18
Part of my work involves comparing dates which I do using the following code.
Dim Date1 As String, Date2 As String
Dim Value1 As Long, Value2 As Long
Private Sub Form_Load()
Date1 = "23/04/01"
Date2 = "01/06/00"
Value1 = CLng(DateValue(Date1))
Value2 = CLng(DateValue(Date2))
Print Value1, Value2
This will only work if the local machine uses dd/mm/yy date format. How can I check the date format of the machine and change it to this format if necessary.
I was thinking of using an API call, but I have never done this and am not sure how to proceed.