Arcade
Arcade

Reputation: 736

ASP.NET MVC3 formatting DateTime

Hi I'm new to MVC3 and if run into a little problem I can't seem so solve.

I have a value in one of my table's that represents the national holiday of a country. So it only contains a day and a month. Now I'm unable to find a way to set my entities validations this way it only accepts a day/month combination.

I tried using

[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/mm}")]

But then it would only show the days correctly and alwayse make the months "00"

Anyone know how to fix this?

Upvotes: 0

Views: 250

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499760

mm means minutes in a DateTime format string. Use MM instead for months.

Upvotes: 3

Related Questions