Home › forums › Using CanvasJS › MySQL xAxis date format
Tagged: DateTime, JSON, mysql
This topic contains 2 replies, has 3 voices, and was last updated by Anjali 4 years, 8 months ago.
First of all lovely product.
I use this in combination with MySQL and json
My date format is “2014-09-23 23:59:59” in mysql DB i would like to only display the time, but somehow this datetime format is nog recognised, can somebody help me out here?
Apparently you have to use milliseconds.
I’m using strtotime in PHP:
strtotime($x) * 1000-3600000
the 3600000 is because I’m on UTC.
CanvasJS Expects the value to be either timeStamp or Date object – stings are not parsed automatically. Hence you can either parse the date at client side or use the time Stamp value.
For displaying the time you can use the valueFormatString property.
Here is an example.
You must be logged in to reply to this topic.