Calculate how long ago the message was sent

Hello family, I am doing a personalized chat, I would like that when the user sends a message it appears to him when he uploaded it. A system similar to the time that kodular handles in its topics.
For instance:

If the user uploaded it at 6:00 p.m. and another user looked at the message at 6:30 p.m., it should not show him the time, but it should show him that the user sent the message 30 minutes ago.

How can I do it?

See here

I uses these block to find the last online time of users from time mills.

I don’t know if the blocks can be reduced.


As is the time format that you put to the process, because I only see that you use a lot of numbers. Could you be more realistic to put me in context please.

I have compared the duration with some mills values.

First: if duration is less than 60000 mills(60 secs) then we’ll calculate the difference in seconds with Duration to second block

Second: if duration is less than 3600000 mills(60 minute) then we’ll calculate the difference in minutes with duration to minute block.

Third: if duration is less than 86400000 mills(24 hours) then we’ll calculate the difference in hours with duration to hours block.

Last: now this is the last condition where we’ll calculate the difference in days(any) with duration to days block.

Only one condition will be invoked as it is surrounded in else if block.
I hope you got the point how I used these blocks.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.