Converting Seconds to friendly date

I have seconds in a value since a user moved the cursor and I want to convert it to a friendly date.

Like instead of 155544545556 seconds ago, I want to display 2 days, 8 hours and 2 minutes ago.

Any class or method to do that?

I’ve not tested it but what about the following:

Var d1 As DateTime = DateTime.Now
Var d2 As New DateTime(d1.SecondsFrom1970 - YourSeconds)
Var interval As DateInterval
interval = d2 - d1

You can then use interval properties to get the string you are after.

Doesn’t seems right

Var d1 As DateTime = DateTime.Now

Yes remove the new from d1.

The script is working but I don’t think the value are right.
First one is System.Ticks and it’s correct and second one is Floor(GlobalIdleTimeMBS) * 60 and it doesn’t match
Screen Shot 2022-10-14 at 15.14.26

Figured. I just had to remove the * 60. All good now. Thanks for the help

I was going to say I don’t know what GlobalIdleTimeMBS returns.

Please mark it as the solution so others find the answer when looking.

Happy it worked.