Link to home
Start Free TrialLog in
Avatar of isnoend2001
isnoend2001Flag 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 ?
SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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")
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.
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
Thanks
Smart! Glad your issue has been resolved.