View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andrew Taylor Andrew Taylor is offline
external usenet poster
 
Posts: 225
Default Converting string "061123" into a date "23/11/06"

Try this :

myString = "061123"

myDate = CDate(Mid(myString, 5, 2) _
& "/" & Mid(myString, 3, 2) _
& "/" & Mid(myString, 1, 2))

or
mydate = DateSerial(Mid(myString, 1, 2), Mid(myString, 3, 2),
Mid(myString, 5, 2))


WhytheQ wrote:

Can anybody help.
I've extracted a string from a file's name, the string is "061123"
When the macro is running I need it to convert this string into a date
formatted dd/mm/yy i.e "23/11/06"

I thought this would be relatively easy but apparently not: can anybody
help ?

Any help appreciated,
Jason.