10 lines
308 B
JavaScript
10 lines
308 B
JavaScript
function quarter_of_the_year(date)
|
|
{
|
|
var month = date.getMonth() + 1;
|
|
return (Math.ceil(month / 3));
|
|
}
|
|
|
|
|
|
console.log(quarter_of_the_year(new Date()));
|
|
console.log(quarter_of_the_year(new Date(2015, 1, 21)));
|
|
console.log(quarter_of_the_year(new Date(2015, 10, 18)));
|