Tag: Quarter

  • Get last and current quarter in javascript

    [js] function getQuarter(id) { var d = new Date(); var quarter = Math.floor((d.getMonth() / 3)); switch (id) { case “Current”: var firstDate = new Date(d.getFullYear(), quarter * 3, 1); var endDate = new Date(firstDate.getFullYear(), firstDate.getMonth() + 3, 0); break; case “Previous”: var firstDate = new Date(d.getFullYear(), quarter * 3 – 3, 1); var endDate =…