AEM 6.5 Date time picker not storing the seconds when i added the date and time in the dialog field. | Community
Skip to main content
Level 2
February 9, 2022
Solved

AEM 6.5 Date time picker not storing the seconds when i added the date and time in the dialog field.

  • February 9, 2022
  • 3 replies
  • 2517 views

AEM 6.5 Date time picker not storing the seconds when i added the date and time in the dialog field.

the seconds always stored as .2022-02-09T11:51:00.000+05:30.PFB screenshot. I need to store seconds as well in the datetime field

---

 

Thanks,

Naresh

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 Nitin_laad

@naresh19 I do not see any error while persisting date using given format. 

Try some other date formats and see if works for you

ex: YYYY-MM-DD[T]HH:mm:ss.000Z 

Check below link - 

https://aem4beginner.blogspot.com/aem-time-formats

 

3 replies

Nitin_laad
Community Advisor
Community Advisor
February 9, 2022

@naresh19 try valueFormat property and forate as "YYYY-MM-DD[T]HH:mm:ss.SSSZ" to get required date format.

naresh19Author
Level 2
February 9, 2022

No luck. i am getting below error msg

---

 

 

 

 

 

Nitin_laad
Community Advisor
Nitin_laadCommunity AdvisorAccepted solution
Community Advisor
February 9, 2022

@naresh19 I do not see any error while persisting date using given format. 

Try some other date formats and see if works for you

ex: YYYY-MM-DD[T]HH:mm:ss.000Z 

Check below link - 

https://aem4beginner.blogspot.com/aem-time-formats

 

lukasz-m
Community Advisor
Community Advisor
February 9, 2022

Hi @naresh19, I think that the only OOTB way to achieve your goal is to change displayedFormat property to allow set seconds value, e.g. MM-DD-YYYY hh:mm:ss. The reason of that is a fact that you need to somehow provide value of seconds that you would like to store in repository. datepicker component will not be able to distinguish value of seconds by itself - user needs to set it - but to make it possible displayedFormat needs to allow to set seconds value.

valueFormat property will not be the case, because as I already wrote above - you have to provide seconds value first.

Alternative solutions will be to create your custom datepicker or what could be simpler, create and use SlingPostProcessor to calculate seconds and add it to the to the value from datepicker.