Format DateTime Returns 0

hvdbovenkamp

Newcomer
Joined
Sep 19, 2008
Messages
1
Location
Rotterdam
Hi there,

I'm stuck with a problem formatting a datetime value:


Dim thisdate As DateTime = #10/15/2005#
Me.Label1.Text = Format(thisdate, "mm/dd/yyyy").ToString

Returns 00/15/2005
setting the month to 00 instead of 10

I must be doing something wrong, for I don't find any mentioning of this problem.

I use VB.NET Visual Studio 2003

Any help is more then welcome !
 
mm is for minutes, MM is for months ;) Also you might find thisdate.ToShortDateString will do the same (and will return the string correctly for the current locale).

In your code the .ToString isn't needed as Format() returns a string anyway.
 
Back
Top