Darren
Darren

Reputation: 793

datetime tostring format changes date in vb.net

I am merely trying to format a datetime object but it appears to be changing the date. In the first line below, the value of ProcessBeginDate is #11/1/2014. As you can see in the image below, after assigning to a string and applying formatting, the string value is "2014-00-01".

How have I managed this??

enter image description here

Upvotes: 1

Views: 240

Answers (1)

Mark
Mark

Reputation: 8160

In a custom date format string, mm is the specifier for a 2-digit minute. The correct specifier for a 2-digit month is MM, so your format string should be yyyy-MM-dd.

Upvotes: 3

Related Questions