What is wrong with this code? I am finding the last file backup with date in the filename e.g. Filename_(2020-01-23).ext. I can extract the date expression from the filename but when I try to change it to date, it gives a different date. The code below is incomplete just showing the relevant bits.
Dim dteCounter, dteCounter2
'dim sLocale
'sLocale=getlocale()
'SetLocale "en-us"
dteCounter = GetLastFile("Man","d:\Data Backup\")
dteCounter = ((Right(Left(dteCounter,Len(dteCounter)-7),10)))
dteCounter = cdate(Month(dteCounter) & "/" & Day(dteCounter) & "/" & Year(dteCounter))
dteCounter2 = cdate("01/23/2020")
MsgBox "The date is: " & (dteCounter) & " : " & (dteCounter2)
'SetLocale sLocale
The message box gives me: The date is: 2/6/2020 : 1/23/2020
Tried to set locale but it still gives me 2/6/2020 instead of 1/23/2020
Dim dteCounter, dteCounter2
'dim sLocale
'sLocale=getlocale()
'SetLocale "en-us"
dteCounter = GetLastFile("Man","d:\Data Backup\")
dteCounter = ((Right(Left(dteCounter,Len(dteCounter)-7),10)))
dteCounter = cdate(Month(dteCounter) & "/" & Day(dteCounter) & "/" & Year(dteCounter))
dteCounter2 = cdate("01/23/2020")
MsgBox "The date is: " & (dteCounter) & " : " & (dteCounter2)
'SetLocale sLocale
The message box gives me: The date is: 2/6/2020 : 1/23/2020
Tried to set locale but it still gives me 2/6/2020 instead of 1/23/2020