[SalesForce] How to create Date picker field in Visualforce page

I need Date picker field in visualforce page.

When select that field the date format should like YYYY-MM-DD

How to achieve this?

Thanks for all your response..

Best Answer

You can bind directly to a date field on an sObject(in my example contact) using Visualforce like this:

<apex:inputField value="{!Contact.BirthDate}" />

Visualforce will render as appropriate based on the data type of your field. So if your using standard Salesforce styles in your page, this will cause the salesforce default calendar to be displayed. Otherwise you can take a look here for some more ideas. Also it may be worthwhile to take a look at this for info on how you can format dates in VF.

Related Topic