Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
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
Last update : 18/07/2021 @ 02:13
Category : Create own software
Page read 1983 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^