Is there any way that you can cutsomize the default calendar so that the user can only modify the year instead of the whole date? I want to fix the date to January 1st.

I have implemented a validation rule, so that the user cannot add a date that is not January 1st, but for filtering records and viewing them, the user can search any date and I want to be able to change this.

I thought about making a picklist containing years only, but I'll have to manually edit them.

1 Answer 1


If you are open to use Custom Visualforce page instead of standard Salesforce pages, here is a solution.

Get the Year through a Picklist or a textBox and build the complete date on your preferable action(i.e either on save, any button click or other events) through a function in controller.

Visualforce Markup

<apex:outputLabel value="1st January"/> &nbsp;
<apex:inputText value={!Year}/>

<apex:commandButton action="{!saveDate}" value="Save"/>


public String Year{get;set}
public PageReference SaveDate()
Date finalDate = Date.parse('01/01/'+Year);
  • One quick thing..you are binding a String datatype to input text VF markup..will you be able to display a DatePicker UI in your VF ?
    – Varun
    May 3, 2015 at 15:23
  • No, I won't be able to display a DatePicker but it's alright
    – Yousra
    May 3, 2015 at 15:57
  • Glad I could help! May 3, 2015 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .