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 8467831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:45:33+00:00 2026-06-10T15:45:33+00:00

I have MVC3 project with Entity. I have Data Annotation on DateTime property with

  • 0

I have MVC3 project with Entity.
I have Data Annotation on DateTime property with DisplayFormat(DataFormatString="{0:dd/MM/yyyy hh:mm:ss}")

Controller with method which has entity as argument and calling view with same entity object, which displaying its date property.

So, I open browser and enter link http://site/entity/method?dateproperty=01/09/2012 01:02:03 (1 September 2012) and it displays 09/01/2012 01:02:03 (9 January 2012).

In view I’m using DisplayFor it’s displaying like dd/MM/yyyy as I have a set DisplayFormat.

Problem is that it’s reading like MM/dd/yyyy instead of dd/MM/yyyy, any solution?

P.S. I have tried globalization in web.config <sysmte.web> but didn’t help.

  • 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-10T15:45:34+00:00Added an answer on June 10, 2026 at 3:45 pm

    I suspect the problem is that you haven’t specified ApplyFormatInEditMode = true in your attribute, so it’s parsing using the default format, but formatting with the format you’re specifying.

    I’m not an MVC dev by any means, but if you want the same format to be used in both directions, I believe you can just change your attribute to:

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

    Note that I’ve changed hh to HH, as I suspect you want a 24-hour format. I’d actually suggest using yyyy-MM-ddTHH:mm:ss (ISO-8601) as a less ambiguous format for the URL parameter – with a more user-centric display format, of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a MVC3 project. Right now I have a table which has
I am writing a MVC3 project. Right now I have a table which has
I have created a new MVC3 project and used the ADO.NET Entity Data Model
I have a new MVC3 project with one Controller called PublicController.cs which contains 4
I have an MVC3 project using the Entity Framework model in which I've marked
I have a MVC3 ASP.NET Project in which I am using jQuery and KendoUI
I have an MVC3 project for which I use NinjectMVC3 for dependency injection -
For a current MVC3 project I have a model that has multiple pages for
First some context: I have an MVC3 .net project which, for the sake of
I have developed a project using MVC3 and Code first Entity Framework 4.0 as

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.