How can I show the week number for the date in Highstock (not Highcharts!)?
My SQL looks like this
select unix_timestamp(date)*1000 week
For @Paweł Fus 's answer, I find out that when the date is 2012/1/1 witch was Sunday,the result is wrong, so I have changed the answer to :
W: function (timestamp) {
var date = new Date(timestamp);
var firstDay = new Date(date.getFullYear(), 0, 1);
var day = firstDay.getDay() == 0 ? 7 : firstDay.getDay();
var days = Math.floor((date.getTime() - firstDay)/86400000) + day; // day numbers from the first Monday of the year to current date
return Math.ceil(days/7);
},