Thread Tools Display Modes
03/06/19, 08:57 AM   #1
Baumkuchen3
AddOn Author - Click to view addons
Join Date: Jan 2019
Posts: 12
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

Last edited by Baumkuchen3 : 03/06/19 at 12:57 PM.
  Reply With Quote
03/06/19, 04:35 PM   #2
Drummerx04
AddOn Author - Click to view addons
Join Date: Sep 2017
Posts: 54
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)
  Reply With Quote

ESOUI » Developer Discussions » Tutorials & Other Helpful Info » CountDown with TimeStamps convert to TimeString

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off