How to get current quarter start and end date from dashboard - Printable Version +- Forums (https://bdn.bdb.ai) +-- Forum: BDB Knowledge Base (https://bdn.bdb.ai/forumdisplay.php?fid=13) +--- Forum: BDB Dashboards Designer (https://bdn.bdb.ai/forumdisplay.php?fid=43) +---- Forum: BDB Designer Q & A (https://bdn.bdb.ai/forumdisplay.php?fid=16) +---- Thread: How to get current quarter start and end date from dashboard (/showthread.php?tid=665) |
How to get current quarter start and end date from dashboard - abhishek_acharya - 12-26-2022 We will get date in yyyy-mm-dd format Quarter indexing starts from zero function current_quarter_start_date(quarter,year){ var aa=year+"-01-01"; var bb=year+"-04-01"; var cc=year+"-07-01"; var dd=year+"-10-01"; if (quarter==1){return aa;} else if (quarter==2){return bb;} else if (quarter==3){return cc;} else {return dd;}} function current_quarter_end_date(quarter,year){ var aa=year+"-03-31"; var bb=year+"-06-30"; var cc=year+"-09-30"; var dd=year+"-12-31"; if (quarter==1){return aa;} else if (quarter==2){return bb;} else if (quarter==3){return cc;} else {return dd;}} var date = new Date(); var year= date.getFullYear(); var current_quarter = Math.ceil((date.getMonth()+1) / 3); var curqtr_start = current_quarter_start_date(current_quarter,year) ); var curqtr_end = current_quarter_end_date(current_quarter,year) ); |