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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:51:58+00:00 2026-06-03T16:51:58+00:00

I have a MVC action that takes one of its parameters a DateTime and

  • 0

I have a MVC action that takes one of its parameters a DateTime and if I pass “17/07/2012” it throws an exception saying that the param is null but cannot have a null value but if I pass 01/07/2012 it is parsed as Jan 07 2012.

I’m passing the dates to the ajax call in DD/MM/YYYY format, should I rely on MM/DD/YYYY format despite the configured culture in web.config?

This is a simple method and there is just this one date parameter.

  • 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-03T16:51:59+00:00Added an answer on June 3, 2026 at 4:51 pm

    You got three safe options to send date parameter in Asp.NET-MVC:

    • Send it as YYYY/MM/DD it’s the ISO standard for international dates.
    • Use POST request instead of GET request.

    • If you want to change the way the default Model Binder binds dates:

    you can change the default model binder to use the user culture using IModelBinder

    public class DateTimeBinder : IModelBinder
    {
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
            var date = value.ConvertTo(typeof(DateTime), CultureInfo.CurrentCulture);
    
            return date;    
        }
    }
    

    And in the Global.Asax write:

    ModelBinders.Binders.Add(typeof(DateTime), new DateTimeBinder());
    ModelBinders.Binders.Add(typeof(DateTime?), new DateTimeBinder());
    

    Read more at this excellent blog that describe why Mvc framework team implemented a default Culture to all users.

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

Sidebar

Related Questions

I have an action method that takes in a string as its only parameter.
I have one controller that takes a username and pass and checks against a
I have an asp.net mvc action that returns a file result. Behind the scenes,
I have a jquery routine that calls an MVC action which will do a
Suppose I have an action that returns an rendered asp.net mvc control and send
I have an ASP.NET MVC 3 controller action. That action is defined as follows:
I have a MVC-app that has a controller with an action that is supposed
I currently have a Spring MVC controller that takes a MultipartFile @RequestMapping(method = RequestMethod.POST)
I create a simple MVC Controller action, that takes some json data - then
I have a long running (4-10 second) MVC action that runs a report 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.