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

  • Home
  • SEARCH
  • 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 8508783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:15:22+00:00 2026-06-11T03:15:22+00:00

I have implemented jquery date picker, but I’m struggling with parsing datetime value. Scenario

  • 0

I have implemented jquery date picker, but I’m struggling with parsing datetime value. Scenario is following, user should select date using jquery datepicker, date should be on following format (dd.MM.yy), datetime value should be sent to the controller using ajax, and receive (for simplicity of these example) some dummy data over json.

I have following

Views/Shared/EditorTemplates/DateTime.cshtml

@model DateTime
@Html.TextBox("", Model.ToString("dd.MM.yy"),  new { @class = "date" })

Views/Home/
@Html.EditorFor(m => m.MyDate)

<script type="text/javascript">
    $('#pickDate').click(function () {
        var date = $('input[name="MyDate"]').val();    
        $.ajax({
            type: 'POST',
            contentType: 'application/json; charset=utf-8',
            data: { MyDate: date }, 
            url: '/Home/DateManipulation',
            success: function (result) { alert('Success');  },
            error: function () { alert("error"); }
        });    
    });
</script>

HomeController.cs
 [HttpPost]
 public JsonResult DateManipulation(string MyDate)
 {
    DateTime date = DateTime.ParseExact(MyDate, "dd.MM.yy", CultureInfo.InvariantCulture);              
    var process = //omitting 
    return Json(process);
 }

And on the _Layout.cshtml I have on dom ready

 $('.date').datepicker({ dateFormat: "dd.MM.yy" });

I’m not getting date on the controller, error is Invalid JSON
primitive: MyDate.

  • 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-11T03:15:24+00:00Added an answer on June 11, 2026 at 3:15 am

    In your call to /Home/DataManipulation/

    <script type="text/javascript">
        $('#pickDate').click(function () {
            var date = $('input[name="MyDate"]').val();    
            $.ajax({
                type: 'POST',
                contentType: 'application/json; charset=utf-8',
                data: { MyDate: date }, 
                url: '/Home/DateManipulation',
                success: function (result) { alert('Success');  },
                error: function () { alert("error"); }
            });    
        });
    </script>
    

    Try replacing data: { MyDate: date } with data: JSON.stringify({ MyDate: date })

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

Sidebar

Related Questions

I have jquery date picker implement trough Shared/EdotorTemplates/DateTime.cshtml like this @model DateTime @Html.TextBox(, Model.ToString(dd.MM.yyyy),
I have implemented the Jquery cycle plugin on my page but I can't get
I know about jquery date-picker but cant understand how to implement it inside a
I have implemented jquery star rating. When user add its rate I save it
I have implemented datepicker following jQuery getting started , using 3 files: <link type=text/css
I have implemented jQuery clone as in the following link: http://jsfiddle.net/sunalive/gqQnJ/5/ Now I want
I have implemented jquery on the site (click on the plus sign) http://pligg.marsgibson.info Issue
I have implemented the jquery ui autocomplete as in the example: autocomplete with custom
I have implemented the jquery scroll text in my php web site. See my
I have implemented an application using jQuery on PhoneGap. In that I'm using a

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.