Preserving milliseconds when passing dates around front end

2016-06-08

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);

   // ...

}

This entry was posted in ASP.Net, ASP.NET MVC, C#.Net, Web Development and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *