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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:38:06+00:00 2026-05-27T17:38:06+00:00

North America’s format for dates is MM/dd/yyyy I am working on project (asp.net MVC

  • 0

North America’s format for dates is MM/dd/yyyy

I am working on project (asp.net MVC 2) for Australia where date format is d/MM/yyyy

in web.config I have

        <globalization
        fileEncoding="utf-8"
        requestEncoding="utf-8"
        responseEncoding="utf-8"
        culture="en-AU"
        uiCulture="en-AU"
        enableClientBasedCulture="true"
    />

in views .net renders dates in right format – “en-AU”, but when I submit form with 14/11/2011 date my ModelState.IsValid equals to False.

How to teach dataannoation to properly validate dates in “en-AU” format?

//update

just found that issue related to GET only

using(Html.BeginForm("Search", "form", FormMethod.Post)) //Works
using(Html.BeginForm("Search", "form", FormMethod.Get)) //Does'n work

**Looks like it is a .net bug !!!

I tried on new mvc2/3 projects

when I use GET, mvc binding doesn’t use current culture**

Thank you.

  • 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-05-27T17:38:07+00:00Added an answer on May 27, 2026 at 5:38 pm

    Finally I’ve got solution thank you for tens of different blog posts and articles. Work perfectly, plus you can apply it not just for dates.

    //Global.asax.cs
    protected void Application_Start()
    {
        ModelBinders.Binders[typeof (DateTime)] = new ForceCultureModelBinder<DateTime>();
        ModelBinders.Binders[typeof(DateTime?)] = new ForceCultureModelBinder<DateTime>();
    }
    

    and class

    public class ForceCultureModelBinder<T> : IModelBinder where T : struct
    {
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            if (bindingContext == null)
                throw new ArgumentNullException("bindingContext");
    
            T? valueAttempt = GetA(bindingContext);
            return valueAttempt == null ? (object) null : valueAttempt.Value;
        }
    
        private T? GetA(ModelBindingContext bindingContext)
        {
            ValueProviderResult valueResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
    
            if (valueResult == null)
                return null;
    
            T? result;
            try
            {
                result = (T?) valueResult.ConvertTo(typeof (T), Thread.CurrentThread.CurrentCulture);
            }
            catch (Exception)
            {
                bindingContext.ModelState.AddModelError(
                        bindingContext.ModelName, 
                        ex.InnerException.Message);
                return null;
            }
    
            return result;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project where I need to have data inherit at
Here's a timely question. The rules in North America* for time change are: the
I have the following xml:- <?xml version=1.0 encoding=UTF-8?> <patent-assignment> <assignment-record> <correspondent> <name>NORTH AMERICA INTERNATIONAL
I'm working on a project that has me approximating text rendered as an image
My app is unable to determine lat/long coordinates over 3G in North America. It
I have this HTML: <div class=region-list id=region_North_America> <strong>North America</strong> </div> and want to add
I have the following xml:- <?xml version=1.0 encoding=UTF-8?> <patent-assignment> <assignment-record> <correspondent> <name>NORTH AMERICA INTERNATIONAL
I have a address like line = 12345 North Drive,,Palm Retreat, CO,CO,92261 When I
I want to display multiple objects in the north part of a java window.
I'm trying to use mechanize to grab prices for New York's metro-north railroad from

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.