Link to home
Start Free TrialLog in
Avatar of hexOffender
hexOffender

asked on

Formatting a Date

I don't know why this wont work:

dim dateIn as string

dateIn= format(myclass.dateIn,"MM/DD/yyyy")

Without the format function I get '6/8/2006' , But I need 2 digit Month and Day.
With the Format Function I get "MM/DD/yyyy"

I have also tried :

dateIn=myClass.dateIn.tostring.format("MM/DD/yyyy")

and

dateIn = myClass.dateIn
        Format(dateIn, "MM/DD/yyyy")
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Hi hexOffender,

It should be: myclass.dateIn.ToString("MM/dd/yyyy")


Cheers!
Avatar of hexOffender
hexOffender

ASKER


I get this:

 Value of type 'String' cannot be converted to 'System.IFormatProvider'.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

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
emoreau,
That was exactly it. The dateIn was a string.
Thanks