Preserving milliseconds when passing dates around front end


Instead of passing the datetime pass the datetime.Ticks which is a (long) numeric value so the complete datetime value will be preserved.

Then convert ticks back to datetime in the server (controller action method).

public ActionResult GetChartLightBox(int EmpId, long RangeStartTicks, long RangeEndTicks)
   var RangeStart = new DateTime(RangeStartTicks);
   var RangeEnd = new DateTime(RangeEndTicks);

   // ...


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: