Skip to Content

SAPUI5 Date formatting issue

dateFormat: sap.ui.core.format.DateFormat.getDateTimeInstance({
		pattern: "yyyyMMdd"
	     })

And later on in the code I format my date like:

// this.datePeriod2 : Mon 31 December 2018 23:59:59 GMT+0100
this.dateFormat.format(this.datePeriod2);

And in the app running on the SAP Gateway it returns:

"20191231"

On my WebIDE it returns:

"20181231"

My question is:

Can someone explain me why in my WebIDE, I do get the right date "20181231" and in the SAP Gateway I get "20191231"? And how do I fix it?

Both UI5 versions are the same: 1.44.8.

I'm really clueless here. Thank you in advance.

Best regards,

Thijs

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Apr 30 at 05:20 PM

    Hi Thijs,

    Your issue might be related to the way the gateway format the date.

    This is how I format my date for example:

    oDateFormat = sap.ui.core.format.DateFormat.getDateInstance({pattern : "yyyy-MM-dd", "UTC": true});

    SAP Note 2511532 may help.

    Cheers,

    Ric.


    Add comment
    10|10000 characters needed characters exceeded