Pass Date Values from Ajax Call to MVC

Don’t do any tricks with data formats. Just use standard function date.toISOString() which returns in ISO8601 format.

from javascript

$.post('/example/do', { date: date.toISOString() }, function (result) {
    console.log(result);
});

from c#

[HttpPost]
public JsonResult Do(DateTime date)
{
     return Json(date.ToString());
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)