私はコードを持っています。MVC 3でdatetime形式を変更する方法
モデル
[Required(ErrorMessage = "Bạn hãy nhập ngày tháng năm sinh")]
[DataType(DataType.Date, ErrorMessage = "Ngày tháng năm sinh không chính xác, bạn hãy nhập lại")]
[ValidationHelper.DateFormat(ErrorMessage = "Ngày tháng năm sinh không chính xác, bạn hãy nhập lại")]
[DisplayFormat(DataFormatString = "{MM/dd/yyyy}")]
[Display(Name = "Ngày sinh")]
public System.DateTime DateOfBirth { get; set; }
ビュー
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm((string)ViewBag.FormAction, "Account"))
{
<fieldset>
<legend>Registration Form</legend>
<ol>
<li>
@Html.LabelFor(m => m.DateOfBirth)
@Html.EditorFor(m => m.DateOfBirth)
@Html.ValidationMessageFor(m => m.DateOfBirth)
</li>
</ol>
</fieldset>
}
私は入力2012年5月31日=>値'05/31/2012' CMTキャップNgàyのために有効ではありません。 私は入力するとき31/05/2012 =>フィールドは、日付でなければなりません。 何が起こったのですか?私はベトナム出身です。私の英語はとても悪いですが、私を助けてください!どうもありがとう! 私のローカルの日付書式yyyy/MM/DD