Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Change date format.

$
0
0

Hey, I am trying to change the format validation for a date to "day/month/year" but whatever I do, it keeps validating for "month/day/year"

This is my Model

        [RequiredAttribute, DisplayAttribute(Name = "Date")]
        [DisplayFormat(DataFormatString = "{0: dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        public DateTime Date { get; set; }

And this the HTML

<div><label asp-for="Date"></label><input asp-for="Date" /><span asp-validation-for="Date"></span></div>

Anyone knows how to fix it?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>