Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8034947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:10:08+00:00 2026-06-05T02:10:08+00:00

I need to create a select box with options showing the current quarter and

  • 0

I need to create a select box with options showing the current quarter and previous 11 quarters in my Vf page.

I dont want to hardcode them as the values would change with a new quarter. This should always default to current quarter.

Any pointers would be helpful

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:10:09+00:00Added an answer on June 5, 2026 at 2:10 am

    Use apex:selectList with selectOptions to display:

    <apex:selectList value="{!quarter}" multiselect="true">
        <apex:selectOptions value="{!listOfQuarters}"/>
    </apex:selectList><p/>
    

    The controller could look like the following:

    public List<SelectOption> getListOfQuarters() {
        List<SelectOption> options = new List<SelectOption>();
    
        // non-dynamic code as an example
    
        options.add(new SelectOption('Q2 2012','Q2 2012'));
        options.add(new SelectOption('Q1 2012','Q1 2012'));
        options.add(new SelectOption('Q4 2011','Q4 2011'));
    
        return options;
    }
    

    To automatically generate the option values, I would use Datetime methods: now() to grab the current date, month() and year() to extract the month and year, and maybe use a Map to lookup the quarter by month, or divide the month number by three and use ceil() to get the current quarter.

    To create the previous 11 quarters, use addMonths() with a negative value, three months at a time inside a loop.

    myDatetime.addMonths(-3)
    

    If you are not using calendar quarters you may be able to use SOQL to query the Period object. You can definitely determine your fiscal year start month:

    SELECT FiscalYearStartMonth FROM Organization
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to add a select box next to each field in a create/update
This is my view page here i have a select box <tr> <td>Chidren</td> <td>:</td>
I have a select box that gets generated dynamically. I want to allow users
I'd like to replace a multiple select box like: <select multiple=multiple name=options> <option value=option1>option1</option>
I would like to create a select box with currently existing brands (e.g. Sony,
I'm trying to create a select box drop down with a twist, Basically this
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution
I need create clone repository. but I do not know where can I get
I need create a document word with Java. And I ask, how can I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.