Display Quarter number based on date in Year

chanikya
Kilo Sage

1.Quarter number

2.Current number

Display Quarter number based on date

Ex: Jan   to march   Between related dates Display Quarter -1

April to June Between related dates Display Quarter -3 etc.

Ex:

now Current date: 2017-01-20       week: Quarter-1;

now Current date:2017-05-14           week: Quarter-2

1 ACCEPTED SOLUTION

remove current.update()



var check= current.u_another_open;


var test = new GlideDateTime(check);


var mn = test.getMonth();


var quar = Math.ceil(mn/3);


gs.log('hellosssssss'+quar);


current.u_dateee=quar;




find_real_file.png


View solution in original post

37 REPLIES 37

Hi Divya Mishra ,



it is working fine,



How can we able to write on week , i mean when i select a date then display that week of date


Ex: 02-01-2018     so then display WW1


        17-01-201     so then display WW3



like this


sekhar kurumoju
Mega Guru

Year Quarter  calculation form Client side  

All Above Solution Are Provide For Server Side I am Giving Solution "Client Script" as well "Catalog Client Script" on  onLoad() Function

function onLoad() {
    //Type appropriate comment here, and begin script below
    //alert(fecha);
    var today_date = new Date();
    var today_date_str = formatDate(today_date, g_user_date_format).toString();
    var array = today_date_str.split("-");
    var month = array[1].toString();
    if (month == "01" || month == "02" || month == "03") {
        g_form.setValue('variables.test', "Quetr-1");
		g_form.setValue('variables.quter', 1);
    } else if (month == "04" || month == "05" || month == "06") {
        g_form.setValue('variables.test', "Quetr-2");
		g_form.setValue('variables.quter', 2);
    } else if (month == "07" || month == "08" || month == "09") {
        g_form.setValue('variables.test', "Quetr-3");
		g_form.setValue('variables.quter', 3);
    } else if (month == "10" || month == "11" || month == "12") {
        g_form.setValue('variables.test', "Quetr-4");
		g_form.setValue('variables.quter', 4);
    }
   

}

"Please mark Helpful given Solution is Correct"

Thank you