cancel
Showing results for 
Search instead for 
Did you mean: 

UserFunc.uInt8ToDate Issue

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (0)