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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:49:38+00:00 2026-06-01T20:49:38+00:00

Consider the following Model: public class ExportRequestsFilter { [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = {0:dd/MM/yyyy})]

  • 0

Consider the following Model:

public class ExportRequestsFilter {
    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
    public DateTime? StartDate { get; set; }

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

    ...

With the respective View:

<script type="text/javascript">
    $(document).ready(function () {
        $(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' }); // this is the datepicker equivalent to dd/MM/yyyy
    });
</script>

...

<% using (Html.BeginForm(FormMethod.Post)) {%>
    ...
    <%: Html.TextBox("StartDate", Model.StartDate, new { @class = "datepicker" })%><br />
    <%: Html.TextBox("EndDate", Model.EndDate, new { @class = "datepicker" })%>

    <input type="submit" class="buttonLink" name="submitButton" value="<%: Html.Resource("Preview") %>" />

Is there any good reason for when the data on StartDate TextBox is 2/4/2012, UpdateModel() sets the StartDate to 4 February 2012 instead of 2 April 2012?

  • 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-01T20:49:40+00:00Added an answer on June 1, 2026 at 8:49 pm

    It depends on the culture settings for the computer doing the parsing of the input. So if the webserver is set to parse the DateTime based on en-US culture it will parse it as MM/dd/yyyy even though the webpage is setup to render it as dd/MM/yyyy. If you want to force the parsing to always be of one format then you have to pass in the Culture information when you call DateTime.Parse inside a custom binder.

    EDIT: Actually I think this can be set in the web.config to use a default culture for the application. Having not worked with different culture settings though I don’t know for sure how to do this.

    MSDN has a good article on globalizing ASP.NET applications that would work with MVC. Also this article on StackOverflow would explain how to do it with MVC in the web.config. If you follow the answer there it should automatically parse the DateTime in the format you are looking for.

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

Sidebar

Related Questions

Consider the following model: public class BandProfileModel { public BandModel Band { get; set;
Consider the following model and controller: public class SimpleModel { [Required(ErrorMessage=Email Address is required.)]
Consider the following Django models: class Host(models.Model): # This is the hostname only name
Consider following script: SET LANGUAGE 'German' GO SET DATEFIRST 1 GO DECLARE @FullDate DATETIME
Consider the following code: [Authenticate(Order = 1)] public ActionResult SomeActionThatRequiresAuthentication() { var model =
Consider I have defined the following models: class Tag(models.Model): name = models.CharField(max_length=20) class Entry(models.Model):
The problem is best explained by example, consider the following two models: class Topping(models.Model):
consider the following model: class Tweet(db.Model): text = db.StringProperty created_at = db.DateTimeProperty() class Company(db.Model):
Please pardon me for a n00bish question. Please consider the following code: public class
Let's consider the following model: class Item(models.Model): pass class TagType(models.Model): tag_name = models.CharField() tag_value_type

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.