I have a requirement, date format to be changed as mm/yy in a VisualForce Page entering values to that field

  • 1
    How dates are entered, how they're displayed and how they're stored in the database are each 3 different subjects with different answers. Input formats don't necessarily affect display formats, especially on other pages because of how the data is stored (in UTC format). Locales affect time/date display as much as anything else unless it's specified.
    – crmprogdev
    May 27, 2015 at 14:00

1 Answer 1


Please refer to the below link https://www.salesforce.com/docs/developer/pages/Content/pages_compref_outputText.htm

  • No your example is for output field, I want it in input field. In a vf page while entering a date it had to be changed to mm/add before change
    – SFDev
    May 27, 2015 at 12:53
  • Ok, OnChange of theat field you call for a jquery or js to change the format of the date field to mm/dd but its of no use since a date field cannot be saved like that, it might change to default type on save. Instead you can give two dependent picklist for users to ener month n year or Save this date as entered and in another field(formula) you can get what you require i.e. mm/yy formated date May 27, 2015 at 13:00
  • Aw, is there no other way around. I want users to enter the date and on save it has to be saved in mm/DC format only.
    – SFDev
    May 27, 2015 at 13:02
  • 1
    Need to check whether this can work, create one text field and in VF page you can mention as <apex:input type=date.. and using a date picker you can achieve date format in a text field and Onchange of that field you can call a function to change its format as u require and save, anyhow it is a text field it will be saved anyway. Please refer to the following links : amsul.ca/pickadate.js/date AND amsul.ca/pickadate.js/date May 27, 2015 at 13:05
  • 1
    Instead of such a complicated workaround I would suggest with two dependent picklist or just two number/ text fields for month n year inputs would work. May 27, 2015 at 13:07

You must log in to answer this question.

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