javascript - Jquery Get date range of quarter -
i trying think of best way accomplish little task trying complete.
i going have 2 drop downs, 1 year , 1 quarter.
the year going show current year + next year.
the quarter drop down show q1, q2, q3, q4
when pick q2 of 2014 want able "here date range" april 1st, 2014 - june 30th, 2014.
i found how figure out quarters of year:
var today = new date(); var quarter = math.floor((today.getmonth() + 3) / 3);
just not sure on simple way implement this.
you can find start , end dates of given quarter:
var year = 2014; var quarter = 1; var start = new date(year,quarter*3-3,1); var end = new date(year,quarter*3,0);
you can format dates want.
Comments
Post a Comment