samedi 25 avril 2015

Why is there time difference between client and server on localhost


Application running on localhost. Server is one hour earlier then client!

Client sends time : Sat Apr 25 2015 00:00:00 GMT-0400 (Eastern Daylight Time)

enter image description here Server receives time: {4/24/2015 11:00:00 PM}

enter image description here

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.

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.

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


Aucun commentaire:

Enregistrer un commentaire