192
Views
8
Comments
Solved
Is there a function that can convert milliseconds to datetime?
Question

I want to convert Milliseconds to DateTime how can I do this?

mvp_badge
MVP
Rank: #2
Solution

Hi Halit,

There's no such Action available out of the box. However, if you have the offset of the milliseconds, e.g. 1970-01-01, you could use the built-in AddSeconds Function like this:

AddSeconds(#1970-01-01#, MilliSeconds / 1000)


Rank: #748

Hi Halit!

You could convert the milliseconds into seconds into bigger time units like seconds, minutes, hours, days or even years using an Assign variable. Convert it to Text data type then use the appropriate built-in DataConversion functions.

Reference:
https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Data_Conversion

Kind regards,
Joseph Enriquez

mvp_badge
MVP
Rank: #2

@Joseph: I already gave Halit the solution. Converting anything to Text and back just for conversion is always bad practice, but in this case I can't see how it would help at all.

mvp_badge
MVP
Rank: #2

Hi Halit,

That seems to make sense :). Glad I could be of help!