tom canny
tom canny

Reputation: 1

Month Calendar fetching wrong date?

I'm trying to have the user select a date on a month calendar and then display it in the format yyyymmdd. Currently I am trying to do it like this:

string date = completionCalendar.SelectionEnd.ToString("yyyymmdd");

However the issue I'm having is that when I run this I either get 00 as the month or 59 and I'm not sure what I've done wrong, any help would be appreciated.

Upvotes: 0

Views: 79

Answers (2)

AntiTcb
AntiTcb

Reputation: 649

"m" is the format for minutes. "M" is for months.

MSDN

Upvotes: 0

Abdellah OUMGHAR
Abdellah OUMGHAR

Reputation: 3745

use MM for Month:

  string date = completionCalendar.SelectionEnd.ToString("yyyyMMdd");

Upvotes: 1

Related Questions