I need to have an action parameter that has a datetime value? Is there a standard way to do this? I need to have something like:
mysite/Controller/Action/2
Try to use toISOString(). It returns string in ISO8601 format.
from javascript
$.get('/example/doGet?date=' + new Date().toISOString(), function (result) {
console.log(result);
});
from c#
[HttpGet]
public JsonResult DoGet(DateTime date)
{
return Json(date.ToString(), JsonRequestBehavior.AllowGet);
}