ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Tutorials & Other Helpful Info (https://www.esoui.com/forums/forumdisplay.php?f=172)
-   -   CountDown with TimeStamps convert to TimeString (https://www.esoui.com/forums/showthread.php?t=8383)

Baumkuchen3 03/06/19 08:57 AM

CountDown with TimeStamps convert to TimeString
 
Hi, i cant figure it out... i just want to show a CountDown in (hh:mm:ss) a Label.

This piece of code calculates the the time till the future time is now.
Code:

local timeRemainingSecs =  GetDiffBetweenTimeStamps(timeInFuture , GetTimeStamp())
So how can i convert the result to a nice looking Time string? I found this but it doesnt really work ... could I get a Example for a CountDown?

It would be perfect when the string would be with leading zeros --> e.g. 12:03:07 (not 12:3:7)

Thanks

Drummerx04 03/06/19 04:35 PM

You are probably looking for:
Lua Code:
  1. os.date("%X", timestamp) -- returns formatted time string

I'm pretty sure if you plug in a timestamp difference, you'll still get what you are looking for. You can read more about it here.

There are ways to explicitly format different aspects of the string (%X is a standard time format)


All times are GMT -6. The time now is 01:13 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI