ASP.NET MVC 3 does not accept my date format settings in Germany - why?

I have a new ASP.NET MVC 3 project, and MVC and Razor are completely new to me ... I can’t understand what it is.

I have a US-English Win7 x64 dev machine running on the English versions of VS 2010 Pro SP1 and ASP.NET MVC 3. But the application I'm working on is a local client and should be all in German and use everything used here formatting and defaults.

In my view model, I defined a type variable DateTimeand added it with some additional hints as to how to display (and edit) this - I need a Swiss-German date formatting that: day.month.year(in this order, separated by periods .- not slashes)

public class MyViewModel
{
    [Display(Name = "Gültig am")]
    [DataType(DataType.Date)]
    [DisplayFormat(DataFormatString="dd.MM.yyyy", ApplyFormatInEditMode=true)]
    public DateTime ValidAt { get; set; }
}

(, , )

Razor , ASP.NET MVC 3 Add View T4:

@Html.EditorFor(model => model.ValidAt)

: - 13.06.2011 (13 2011 .), , , , , , The value '13.06.2011' is invalid -

- (, , ), .

,

+3
1
+1

All Articles