Share your opinion
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
|
Create own software - Convert seconds in day hours minutes seconds
Hi,
Today a small interesting idea to convert seconds in day,month,hours,minutes,seconds as this format : 1d50h30m20s Here code of this function, we use WHILE WEND loop : Private Sub cvjhms(mysecond As Integer) As String ' convert seconds in day month hours minutes seconds from seconds Dim myresult As String Dim myday As Integer Dim myhour As Integer Dim myminutes As Integer While mysecond >= 86400 Inc myday mysecond = mysecond - 86400 Wend While mysecond >= 3600 Inc myhour mysecond = mysecond - 3600 Wend While mysecond >= 60 Inc myminutes mysecond = mysecond - 60 Wend myresult = Str(myday) & "d" & Str(myhour) & "h" & Str(myminutes) & "m" & Str(mysecond) & "s" Return myresult End and to call this method write this : dim myresult as string myresult = cvjhms(456789) '456789 is seconds to convert in text. thanks for your attention. Creation date : 18/07/2021 @ 02:13 Reactions to this article
| QUICK MENU
SEARCH
LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS
visitors visitors online ARCHIVES GAMBAS 1/2
|