title: Handling Datetime datatype between javascript and WebApi 2
body: <p>I would like to know whether the following is the right method to handle datetime data type in WebApi 2, Javascript and database.</p>
  
  <p><strong>DateTime from Javascript to WebApi:</strong></p>
  
  <pre><code>var date = new Date();
  var datestring = date.toISOString();
  //Send datestring to WebApi
  </code></pre>
  
  <p><strong>DateTime from WebApi to Javascript:</strong></p>
  
  <pre><code>//on getting datetime value from `http.get` call 
  var dateFromServer = new Date(dateFromServer); 
  </code></pre>
  
  <p><strong>WebApi:</strong></p>
  
  <blockquote>
    <p>Incoming date</p>
  </blockquote>
  
  <ul>
  <li>do nothing simply store the <code>datestring</code> returned in database column with datatype <code>datetime</code></li>
  </ul>
  
  <blockquote>
    <p>Getting date from database and Returning date to client:</p>
  </blockquote>
  
  <ul>
  <li>no datetime manipulation (simply return as per WebApi Json serializer ex: 2015-10-23T18:30:00). Client would automatically convert the UTC datetime to local datetime</li>
  </ul>