When trying to use Unix time (1608713282) for my amChart source and display it as 12/23/20 04:30:00, I encountered an issue where it was showing up as 01/19/70 00:00:00 in the tooltip.
I attempted to format it correctly on the chart and dateAxis using the following lines of code...
chart.dateFormatter.inputDateFormat = 'x';
chart.dataSource.parser.options.dateFormat = 'x';
chart.dateFormatter.utc = true;
dateAxis.dateFormatter.inputDateFormat = 'x';
dateAxis.dataSource.parser.options.dateFormat = 'x';
dateAxis.dateFormatter.utc = true;
The section related to my dateAxis is as follows:
// TimeStamp Axes
var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.grid.template.location = 0;
dateAxis.renderer.minGridDistance = 100;
dateAxis.tooltipDateFormat = 'MM/dd/yy H:mm:ss';
During debugging, I noticed that enclosing the timestamp value in quotes within my JSON source resulted in a different but still incorrect date being displayed - 11/16/13 23:59:58.
An example of my data structure is shown below:
{
"tstamp": 1608697800,
"vol": 144,
"staff": 61,
"avail": 0
}