options = { xaxes: [{ tickFormatter: xTickFormatter, mode: "time", timezone: "browser" }],
and xTickFormatter looks like this:
function xTickFormatter (val, axis) { var d = new Date(val), h, m; h = d.getHours(); m = d.getMinutes(); m = m < 10 ? "0" + m : m; return [ d.getDate(), " ", months[d.getMonth()], "<br>", h, ":", m ].join(""); }
months[] is an array defined earlier:
months = ["Jan", "Feb" . . . "Nov", "Dec"];
SELECT UNIX_TIMESTAMP(datetime_column) as unix_timestamp FROM table ORDER BY datetime_column DESC.
$query = "SELECT * FROM (SELECT * FROM outside ORDER BY id DESC LIMIT $limit) AS foo ORDER BY id ASC"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $dataset1[] = array(($row['unixtime'] * 1000 ),$row['temperature']); }