All:
I wonder if there is a function in javascript that can get the week order of a Date, for example:
01/05/2016 is in the second week of this year, so the week order is 1(let start by 0)
Thanks
All:
I wonder if there is a function in javascript that can get the week order of a Date, for example:
01/05/2016 is in the second week of this year, so the week order is 1(let start by 0)
Thanks
You can calculate the days pass from the begining of the year and calculate the number of weeks by deviding it to 7 (yhe number of the days in a week):
var now = new Date();
var start = new Date(now.getFullYear(), 0, 0);
var diff = now - start;
var oneDay = 1000 * 60 * 60 * 24;
var day = Math.floor(diff / oneDay);
var week = Math.floor(day/7);
alert(week);