
hi friends,
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
Hey Arun,
Try this:<apex:page>
<script>
function formatDate()
{
if(document.getElementById('date-input').value!='')
document.getElementById('date-input').value =
new Date(document.getElementById('date-input').value).toISOString().split('T')[0];
}
</script>
<apex:form>
Select the Date
<input
id="date-input"
type="input"
onFocus="DatePicker.pickDate(false, 'date-input', true);"
onBlur="return formatDate();"
/>
</apex:form>
</apex:page>
This will work for you.
Regards,
Deepak