You must be logged in to post your query.
Home › Forums › Chart Support › Data format "1272652200000"
Hi, Can You explain how this format is work? It is hard to understand for me ;) Bellow is some example (https://canvasjs.com/docs/charts/chart-options/data/xvaluetype/)
data: [ { type: “column”, xValueType: “dateTime”, dataPoints: [
{ x: 1088620200000, y :71}, { x: 1104517800000, y : 55 }, { x: 1112293800000, y: 50 }, { x: 1136053800000, y : 65 }, { x: 1157049000000, y : 95 }, { x: 1162319400000, y : 68 }, { x: 1180636200000, y : 28 }, { x: 1193855400000, y : 34 }, { x: 1209580200000, y : 14 }, { x: 1230748200000, y : 34 }, { x: 1241116200000, y : 44 }, { x: 1262284200000, y : 84 }, { x: 1272652200000, y : 4 }, { x: 1291141800000, y : 44 }, { x: 1304188200000, y : 11 } ] } ] }); Thx ;)
@lolq9,
This format is termed as Timestamp. The Unix timestamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the Unix timestamp is merely the number of seconds between a particular date and the Unix Epoch. For more information, kindly read this Wikipedia article. In JavaScript, a timestamp is the number of milliseconds that have passed since January 1, 1970, hence you need to multiply the Unix timestamp by 1000 to convert it to JS timestamp.
— Shashi Ranjan Team CanvasJS
OK, so this is a great assistance. However, how do I explain to the Chart that I want the dates displayed in my time zone?
@jhodgeswaterford,
You can use the toLocaleString() method to convert a Date object to a string, using locale settings. The timeZone argument of toLocaleString() are used to parse and output dates that are in UTC or local time to a specific time zone.
You must be logged in to reply to this topic. Login/Register