Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Unable to set datetime format for third party datetime picker

Hi,

          In our sap ui5 application we used third party date time picker plugin in one pop-up  for insert update operations. Client told us to do not use the sap.m date time picker so we don't have any other choice that's why we have chosen one third party date time picker plugin .While inserting the date it was working fine but while retrieving the date time value from service to pop-up for update functionality the format has been changed completely.So i want to set the format for that date time picker i have tried the below code but does not worked fine will any one please give some suggestion....

var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern: "MM/d/y H:mm:ss A"});

var formattedStartDate = oDateFormat.format((startDate));

startDate.setValue(formattedStartDate);

Thanks in Advance for your help.

Regards

Selva

Tags:
Former Member
Former Member replied

Hi Selva,

For setting the Date to the UI, make sure your entity is having the date field in Edm.DateTime type and your model is having date field in PT format, for eg. PT14H01M00S.

For more clarity, pls see this link

http://scn.sap.com/community/developer-center/front-end/blog/2013/04/28/working-with-odata-dates

Also let us know if you are getting any error in your browser console while setting the date to UI control.

Thanks

Naveenraj

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question