WCF and Daylight Saving Time [closed]

1

I'm having a date conversion problem in WCF.

I get a Json a DateTime in Unix format

 "\/Date(1477320927000)\/" - 24-10-2016 12:55:27.

Wcf receives this date as 24-10-2016 14:55:27. It gives a difference of 2 hours.

I tried to use TimeZone , CultureInfo , DateTimeKind , DateTimeOffSet , etc. But nothing worked or puts a 1 less or 2 more hours.

Does anyone know how to solve this?

    
asked by anonymous 26.10.2016 / 14:33

1 answer

1

Try to use the following method:

public static DateTime FromUnixTimeMilliseconds(Int64 value)
{
    DateTime dt = new DateTime((value * 10000) + 621355968000000000, DateTimeKind.Utc);
    return dt.ToLocalTime();
}

Output image:

    
26.10.2016 / 15:27