You must be logged in to post your query.
Home › Forums › Chart Support › DateTime to Double
Tagged: C#, DateTime to Double
Hi! I have a question.
Now I’m using C# to develop some KPIs, but I got a problem.
In this chart https://canvasjs.com/asp-net-mvc-charts/chart-with-crosshair/
How do you take the date into double? I use the .ToOADate(), but it just returns -> 43803 and in the example of the Chart is “1513621800000” How do you do that?
@9dan7,
You can use GetTimestamp() to convert C# date to timestamp(in seconds), then converting the same to JavaScript timestamp(in milliseconds) before passing it to the chart options should work fine in your case.
__________ Indranil Deo Team CanvasJS
Thank you Indranil Deo, also I found this example:
https://stackoverflow.com/questions/49248822/convert-current-date-and-time-into-timestamp-object-13-digits?noredirect=1&lq=1
Thanks Best Regards.
Thanks for sharing the link. It might help others who have similar usecase.
You must be logged in to reply to this topic. Login/Register