[VBA]Convert a string to date
Solved
greenthumb
-
Oli -
Oli -
Hello,
I have a problem with dates in VBA...
Let's say I have a string st = "12/03/2009" and I want to convert it to Date...
Does anyone know how to do this?
PS: I am new to VBA
Best regards,
green
I have a problem with dates in VBA...
Let's say I have a string st = "12/03/2009" and I want to convert it to Date...
Does anyone know how to do this?
PS: I am new to VBA
Best regards,
green
Configuration: Windows 2000 Firefox 3.0.7
9 réponses
only useful when...
MyDate = "February 12, 1969" ' Defines the date.
MyShortDate = CDate(MyDate) ' Converts to Date type.
Otherwise, dates written in literal form like 12/12/2008 for example, are automatically considered as a date.
--
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
MyDate = "February 12, 1969" ' Defines the date.
MyShortDate = CDate(MyDate) ' Converts to Date type.
Otherwise, dates written in literal form like 12/12/2008 for example, are automatically considered as a date.
--
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
Oli
You're welcome!