Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8458723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:09:23+00:00 2026-06-10T13:09:23+00:00

I have this model with the following data annotation because I want to handle

  • 0

I have this model with the following data annotation because I want to handle the date in this format : dd.MM.yyyy

[DataType(DataType.Date)]
[DateRange(ErrorMessageResourceName = "DateBetween", ErrorMessageResourceType = typeof(WizardStrings))]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}")]
public DateTime? BirthDate1 { get; set; }

In the view :

@Html.EditorFor(model => model.BirthDate1 )
@Html.ValidationMessageFor(model => model.BirthDate1)

MVC still render this date with the following format : dd/MM/yyyy it seems like it doesn’t take my data annotation into account.

See the rendered HTML :

<input class="text-box single-line valid" data-val="true" data-val-required="La date de naissance est requise!" id="BirthDate1" name="BirthDate1" type="text" value="**9/9/1999 12:00:00 AM**">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:09:24+00:00Added an answer on June 10, 2026 at 1:09 pm

    Before DataFormatString try adding ApplyFormatInEditMode = true

    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd.MM.yyyy}")] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Model and Controller files, and when i visit this url,
I'm following this MVC model: http://java.sun.com/developer/technicalArticles/javase/mvc/ In my model I have an ArrayList shapes
We have the following data model: CalendarAppointment 1 <------> * AppointmentRole * <--------> 1
Given a model like this ProductFacets contains the following data: ProductId, FacetTypeId 1, 1
I have the following model: class test_data_urls(models.Model): url = models.CharField(max_length=200, db_index=True) I want to
In my model, the field Length is a TimeSpan with the following Data Annotation:
I came across the following issue: I have this model public class Region {
I have the following data model: Camp -> CampEvent <- Event. Camp has CampId
I have this following query for CodeIgniter: $q = $this->db->where('(message_from='.$user_id.' AND message_to='.$this->auth_model->userdata['user_id'].')') ->or_where('(message_from='.$this->auth_model->userdata['user_id'].' AND
I have this model in django: class JournalsGeneral(models.Model): jid = models.AutoField(primary_key=True) code = models.CharField(Code,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.