Quote:
Originally Posted by disel2010
Hi,
just parse the string to date and use the toString with a specific DateFormat afterwards.
There are actually hundred ways to do this, in one way it could look like this:
Code:
Public Function CustomConversion(dateString as String) As String
Dim dateFormatIn, dateFormatOut As String
Dim myDate As Date
dateFormatIn = "MMddyyyy"
dateFormatOut = "yyyyMMdd"
myDate = Date.ParseExact(dateString, dateFormatIn, provider)
return myDate.ToString(dateFormatOut)
End Function
You probably want to make it a bit safer by using TryParseExact etcetera but you get the idea..
Success !
|
Hi
can you tell me how to open the file here like
Public Function CustomConversion(dateString as String) As String
Dim dateFormatIn, dateFormatOut As String
Dim myDate As Date ' where can i put the code open file C:\dates.txt
dateFormatIn = "MMddyyyy"
dateFormatOut = "yyyyMMdd"
myDate = Date.ParseExact(dateString, dateFormatIn, provider)
return myDate.ToString(dateFormatOut)
End Function