Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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

naresh19_0-1644400213393.png

---

naresh19_1-1644400299481.png

 

Thanks,

Naresh

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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

 

View solution in original post

5 Replies

Avatar

Community Advisor

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

Avatar

Correct answer by
Community Advisor

@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

 

Avatar

Community Advisor

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.