There's a graph I'm using from CanvasJS which I've inserted data into from our SQL Server. I'm having an issue though where for one of the axis, I need it to show as a date. CanvasJS comes with the function to be able to set the value type for the axis between two settings, 'dateTime' and 'number'.
The format CanvasJS is using is a 13 digit string, ex. "1088620200000". When using https://timestamp.online/ to check what it converts to, it looks like all the examples have 3 extra 0's added to the end of it, because when you take off those extra 0's it translates to June 30th, 2004 which is correct from the example.
I've used this line in my query to convert my datestamps to strings. Originally, I had the start date as a suggested default of "1990-1-1", but saw it was adding incorrectly and I adjusted it to give almost the right dates.
CAST(CAST(DATEDIFF(minute, '1990-5-28 00:00', ##customOrderMetrics.METRIC_DATE) AS BIGINT) AS VARCHAR)+'00' AS METRIC_DATE
My issue here is that it seems to be converting correctly but does so in a weird way. It's adding uneven amounts to the days and I'd like it to just jump 24 hours or 1 day. So, I have 4 rows coming from the query and they look like this.
1/4/2021, 8:00:00 AM - 1609776000
1/6/2021, 12:00:00 AM - 1609920000
1/7/2021, 4:00:00 PM - 1610064000
1/9/2021, 8:00:00 AM - 1610208000
This was really tough to explain, but I hope it makes some sense. Really would appreciate any help and hope I'm not missing something simple here. Thanks in advance.