I'm using C#.
When I'm trying to get the current time with the follow line:
var time = TimeSpan.FromMilliseconds((dtNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()).TotalMilliseconds);
var date = new DateTime(time.Ticks);
As per the documentation, the
ticks parameter is not from 1970, it's from the year 1:
A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar.