Avatar of isnoend2001
isnoend2001
Flag for United States of America asked on

Change Date format 12/26/2015 to 12-26-2015 vb6

This does not work
FutureYr = Format(FutureYr, "mm-dd-yyyy")
It does not change the format.
How to do this ?
Visual Basic Classic

Avatar of undefined
Last Comment
Subodh Tiwari (Neeraj)

8/22/2022 - Mon
SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Subodh Tiwari (Neeraj)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
isnoend2001

ASKER
Sorry about the late reply,had to run an unexpected errand
Dim FutureYr As Date
this did not fix it:
FutureYr = Format(DateValue(FutureYr), "mm-dd-yyyy")
Subodh Tiwari (Neeraj)

Use MsgBox FutureYr or Debug.Print FutureYr to see the value in immediate window. Do you see it in desired format?

How do you know that you don't get it in right format? What do you do next with FutureYr, do you place its value on the sheet or what?

If you are placing the value of FutureYr on the sheet, that might not work as sheet's default date separator will take over.
isnoend2001

ASKER
Have already used debug, don't know why vb ignores the format.
Have overcame the issue by converting the date to a string using cstr
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
isnoend2001

ASKER
Thanks
Subodh Tiwari (Neeraj)

Smart! Glad your issue has been resolved.