I have Entity class with datetime filed, I want to select distinct \'mon-yyyy\' format datetime filed value and populate drop down list.
the following code giving me
I used a workaround to build the formats containing yyyy and MM manually. I would like to mention it here if it may help someone (at least temporarily):
yyyy
MM
FormattedDate = d.ReportDate.Year.ToString() + "-" + d.ReportDate.Month.ToString()
this makes the format yyyy-MM
yyyy-MM