The property Now from C # brings the current date and time, different from JS Now.
The Millisecond property returns an integer equivalent to the milliseconds of the time Now was evaluated. It's clearer with the example below:
Console.WriteLine("Data com millisegundos: {0:MM/dd/yyy HH:mm:ss.fff}, {1}",
DateTime.Now,DateTime.Now.Millisecond);
To create the same behavior in C # you should do this:
using System;
public class Program
{
public static void Main()
{
DateTime d1 = new DateTime(1970, 1, 1);
DateTime d2 = DateTime.Now;
double x = new TimeSpan(d2.Ticks - d1.Ticks).TotalMilliseconds;
double y =((DateTimeOffset)DateTime.UtcNow).ToUnixTimeMilliseconds();
Console.WriteLine("Calculo com Ticks {0}",x);
Console.WriteLine("Calculo com UtcNow {0}",y);
}
}
Note that the Ticks method has a slightly higher resolution than the method with UTCNow.
See working at .NET Fiddle