Skip to main content
added 12 characters in body
Source Link
Krishna Bidwai
  • 979
  • 1
  • 10
  • 26

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer iquarter = date.today().month()/3;
if(monthquarter == 0)
    system.debug('==FirstQuarter==';
else if(monthquarter == 1)
    system.debug('==SecondQuarter==');
else if (monthquarter == 2)
      system.debug('==ThirdQuarter==');
else 
      system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer i = date.today().month()/3;
if(month == 0)
    system.debug('==FirstQuarter==';
else if(month == 1)
    system.debug('==SecondQuarter==');
else if (month == 2)
      system.debug('==ThirdQuarter==');
else 
      system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer quarter = date.today().month()/3;
if(quarter == 0)
    system.debug('==FirstQuarter==';
else if(quarter == 1)
    system.debug('==SecondQuarter==');
else if (quarter == 2)
      system.debug('==ThirdQuarter==');
else 
      system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

added 32 characters in body
Source Link
Ratan Paul
  • 22.8k
  • 14
  • 55
  • 99

You can use Date.Month()Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer i = date.today().month()/3;
if(month == 0)
    system.debug('==FirstQuarter==';
else if(month == 1)
    system.debug('==SecondQuarter==');
else if (month == 2)
      system.debug('==ThirdQuarter==');
else 
      system.debug('==fourthQuarter==');

if(month == 0) system.debug('==FirstQuarter=='; else if(month == 1) system.debug('==SecondQuarter=='); else if (month == 2) system.debug('==ThirdQuarter=='); else system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer i = date.today().month()/3;

if(month == 0) system.debug('==FirstQuarter=='; else if(month == 1) system.debug('==SecondQuarter=='); else if (month == 2) system.debug('==ThirdQuarter=='); else system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer i = date.today().month()/3;
if(month == 0)
    system.debug('==FirstQuarter==';
else if(month == 1)
    system.debug('==SecondQuarter==');
else if (month == 2)
      system.debug('==ThirdQuarter==');
else 
      system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

Added Example
Source Link
Krishna Bidwai
  • 979
  • 1
  • 10
  • 26

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer i = date.today().month()/3;

if(month == 0) system.debug('==FirstQuarter=='; else if(month == 1) system.debug('==SecondQuarter=='); else if (month == 2) system.debug('==ThirdQuarter=='); else system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter.

Hope this helps!!!

Regards, Krishna

You can use Date.Month() for the the month value, here you will get integer value like 1 for Jan...12 for Dec then from this value you can easily get its quarter. Here is example for you:

Integer i = date.today().month()/3;

if(month == 0) system.debug('==FirstQuarter=='; else if(month == 1) system.debug('==SecondQuarter=='); else if (month == 2) system.debug('==ThirdQuarter=='); else system.debug('==fourthQuarter==');

Hope this helps!!!

Regards, Krishna

Source Link
Krishna Bidwai
  • 979
  • 1
  • 10
  • 26
Loading