Application is running on localhost. Server is one hour earlier than client!
Client sends time : Sat Apr 25 2015 00:00:00 GMT-0400 (Eastern Daylight Time)
Request is sent: dateOfArrival: "2015-04-25T04:00:00.000Z"
Server receives time: {4/24/2015 11:00:00 PM}
Why is there one hour difference between and how can I handle it? I could guess it is somehow related Daylight time vs Standart time.
When I try this code:
string dateStr = "2015-04-25T04:00:00.000Z";
var myDate = DateTime.Parse(dateStr); // it gives me myDate = {4/25/2015 12:00:00 AM}
Actually I am only interested day part of time. In my db, I am holding it as Date type. But because of this time difference, my days goes one day before.
I tried various ways to handle issue but I got completely lost in datetime conversion world! Even I am lost on localhost application, I could not imagine what will happen on live server.
I think this Q&A also mentions similar issue, but I can't figure it out if it matters:
My timezone: Eastern Time Zone (UTC-05:00)
About web api odata json serializer, from this post I could say that it is other then this one
Here is my server code:
// PATCH: odata/IncomingStudents(5)
[AcceptVerbs("PATCH", "MERGE")]
public async Task<IHttpActionResult> Patch([FromODataUri] int key, Delta<IncomingStudent> patch)
{
Validate(patch.GetEntity());
var dateOfArrival = patch.GetEntity().DateOfArrival
...
}
Client is angularjs sending http patch request