0
   public object postDate(DateTime start)
    {
      //Save the DateTime to sql Server
      //return success code or object

    }

How's the json string look like to post DateTime?

1

1 Answer 1

1

Make an object and wrap it to this like:

Public class SampleModel
{
    Public DateTime Start {get; set;}
}

then POST it to the Action:

 public object postDate(SampleModel sampleModel)
{
  // sampleModel.Start
  //Save the DateTime to sql Server
  //return success code or object

}

JSON must be like this:

 {
  "Start":"2017-05-11T09:18:54.092Z"
 }
Sign up to request clarification or add additional context in comments.

4 Comments

how the json string look like when posting DateTime?
I put a sample of json in the end of my answer.
Thanks it's okay now :) { "StartTime":"2017-05-17 14:04:58" } Btw this one also working :)
Working for me without Z "Start":"2017-05-11T09:18:54.092"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.