Skip to main content

Posts

Showing posts from 2016

Converting DateTime C# to DateTime.UTC javascript

Here is a simple way to change a C# datetime to a javascript Datetime.UTC value that can be used in the highcharts pointstart field. In C# private double DateUTCDate(DateTime date) { return date.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds } This will return a value that can be used directly in javascript series: { pointStart: dataFromCsharp, pointInterval: 3600 * 1000 // one day } highcharts pointstart only used Date.UTC values if you are timestamp for the x-axis