Want to save datepicker value to specific format (YY-MM-DD) | Community
Skip to main content
khamat_bn
Level 4
June 22, 2020
Solved

Want to save datepicker value to specific format (YY-MM-DD)

  • June 22, 2020
  • 1 reply
  • 1410 views

Hi Folks ,

 

I have used datepicker in the dialog and it's saving the values in 2020-06-22T00:00:00.000+05:30 like format. 

I want to save the date value in (YY-MM-DD) format.

I have used granite/ui/components/coral/foundation/form/datepicker.

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Theo_Pendle

Hi @khamat_bn,

Yes, you can provide a format using the valueFormat property. See the docs here: https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/datepicker/index.html

Here is an example where I set the format to YYY-MM-DD. The datepicker node:

The resulting value saved in the field:

1 reply

Theo_Pendle
Theo_PendleAccepted solution
Level 8
June 22, 2020

Hi @khamat_bn,

Yes, you can provide a format using the valueFormat property. See the docs here: https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/datepicker/index.html

Here is an example where I set the format to YYY-MM-DD. The datepicker node:

The resulting value saved in the field:

kautuk_sahni
Community Manager
Community Manager
June 23, 2020
Great answer. Very well written.
Kautuk Sahni