Skip to Content

Date conversion format


Is there any function or formatter available which converts ANY date format (which a user inputs) into a standard format that OData accepts?

Does a UI5 Application on launchpad tile accept the date in the format which is locally set on the system?

Here's the scenario:

We have created a Travel creation app, in which the date format is set to the following: eg: Jul 7, 2016

So we have used a function that converts the date from this format to a format that the OData accepts using the following code:

var date_temp = this.byId("DP4").getValue();

var temp = date_temp.split(" ");

var month = temp[0];

var temp1 = temp[1].split(",");

var day = temp1[0];

var year = temp[2];

var months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',

'Sep', 'Oct', 'Nov', 'Dec' ];

for (var j = 0; j < months.length; j++) {

if (month == months[j]) {

month = months.indexOf(months[j]) + 1;



if (month < 10) {

month = '0' + month;


datefrom = year + "-" + month + "-" + day;

But the same application displays a different format on the client system (07-Jul-2016). And due to the the function that we used to convert the date fails.

I need a function that extracts the date from any format, and converts it into a standard format. Pls help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 10, 2015 at 10:06 AM

    What ever the date format, forget about it.

    if you call getDateValue() it will returns the system date format so write formatter to convert system date format to oData Date format.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.