Skip to Content
avatar image
Former Member

UserFunc.uInt8ToDate Issue

Has anyone else had this problem? I was trying to use the internal function uInt8ToDate function. The parameters, according to SAP's documentation, allow you to add a "True" option to the call which makes the function convert the date to local time. The default converts the date to UTC time. The call would look like this:

var result = UserFunc.uInt8ToDate(Par,True)

Whenever I try to do this, I get an error. If I exclude the "True" and let the function default to "False", it works fine, i.e.:

var result = UserFunc.uInt8ToDate(Par)

Why doesn't this switch to convert to local time work? The contract I'm working on right now is a global company so converting to local time won't hold me up at all but I'm just curious why this feature is documented by SAP as a functional option but doesn't work in practice. Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Dec 18, 2013 at 06:37 PM

    While I never did find the actual answer to this question, I did find a workaround. You can use the JavaScript "new Date()" function to convert the string uInt8ToDate returns into an actual date object. By default, uInt8ToDate returns the date as a string.

    var result = new Date(UserFunc.uInt8ToDate(Par))

    Once it's an actual date object, you can use Date's other built in functions to convert to local time. Again, not an answer as to why the "True" switch doesn't work but a viable workaround.

    Add comment
    10|10000 characters needed characters exceeded