base:Milliseconds()

You can post your code snippets here for others to use and learn from
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

base:Milliseconds()

Post by djrikki » Wed Apr 15, 2015 10:50 pm

Return milliseconds as Days, Hours, Minutes and Seconds.

Code: Select all

Global base
base ] {}

;; base:Milliseconds(milliseconds)
; Convert milliseconds into Days, Hours, Minutes and Seconds
Function base:Milliseconds(milliseconds)
    Local d, h, m, s
    
    milliseconds = ToNumber(milliseconds)

    d = milliseconds / 86400000
    h = milliseconds / (1000*60*60)
    m = (milliseconds % (1000*60*60)) / (1000*60)
    s = ((milliseconds % (1000*60*60)) % (1000*60)) / 1000
    
    If d > 1
        If h > 24
            h = h / 24
        EndIf
    EndIf
    
    Return(d, h, m, s)
EndFunction
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com

Post Reply