Jump to content

countdown from specific hour


MeisterMan
 Share

Go to solution Solved by MeisterMan,

Recommended Posts

im trying to do a time-left thing like in this  script '?do=embed' frameborder='0' data-embedContent>>

but i dont get how...

ive tryed for last 2 days...  finaly i decided to get help.

#include <ButtonConstants.au3>
#include <SliderConstants.au3>
#include <GuiTab.au3>

#include <ComboConstants.au3>
#include <ListViewConstants.au3>
#include <Date.au3>
#include <EditConstants.au3>
#include <GUIListBox.au3>
#Include <GuiComboBox.au3>
#include <ProgressConstants.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <File.au3>
#include <UpdownConstants.au3>
#include <GuiListView.au3>
#include <Misc.au3>
#include <Inet.au3>
#include <TabConstants.au3>

Opt("GUIOnEventMode", 1)



#cs
00:00 - 04:00 - 08:00 - 12:00 - 16:00 - 20:00
#ce
Global $TimeTable[6] = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]
Global $Sec, $Min, $Hour, $Time
Global $countdown = $TimeTable[1] ;minutes for countdown
Global $seconds = $countdown * 60 ;convert to seconds


MsgBox(0,"", _DateDiff("h", _NowTime(4),$TimeTable[1])) ;"YYYY/MM/DD[ HH:MM:SS]"
;~ If _NowTime(4) >= $TimeTable[0] Then MsgBox(0,  $TimeTable[5],  $TimeTable[0])
;~ MsgBox(0, "", _DateDiff("h", "04:00" ,_NowTime(4)))

$GUI = GUICreate("#cabal Nation War Alarm#", 300, 120, -1, -1, -1, $WS_EX_TOOLWINDOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIEvents")
GUISetBkColor(0x000000)

$time = GUICtrlCreateLabel("00:00", 10, 10, 280, 80, $SS_CENTER)
GUICtrlSetFont($time, 50, -1, -1)
GUICtrlSetColor($time, 0x00b711)
GUICtrlSetData($time, _NowTime(4))
$timeLeft = GUICtrlCreateLabel("00:00:00", 240, 95, 50, 20)
GUICtrlSetColor($timeLeft, 0xffae00)

$options = GUICtrlCreateButton("Options", 5, 95, 50, 20) ; set alarm volume / set transparency to gui...

$onTop = GUICtrlCreateButton("KeepTop", 60, 95, 70, 20)
GUICtrlSetOnEvent($onTop, "OnTopControl")
Func OnTopControl()
    If GUICtrlRead($onTop) = "KeepTop" Then
            WinSetOnTop($GUI, "", 1)
            WinSetTrans($GUI, "", 180)
            GUICtrlSetData($onTop, "Normal")
        ElseIf GUICtrlRead($onTop) = "Normal" Then
            WinSetOnTop($GUI, "", 0)
            WinSetTrans($GUI, "", 255)
            GUICtrlSetData($onTop, "KeepTop")
        EndIf
EndFunc

GUISetState()
AdlibRegister("CheckTime", 1000)
While 1

WEnd
Func CheckTime()
    GUICtrlSetData($time, _NowTime(4))
    If _NowTime(4) >= $TimeTable[0] Then
        ; calculate with time
        Local $StartTicks = _TimeToTicks(@HOUR, @MIN, @SEC)
        ; calculate 45 minutes later
        Local $EndTicks = $StartTicks
        _TicksToTime($EndTicks, $Hour, $Min, $Sec)
;~      MsgBox(262144, '', 'New Time:' & $Hour & ":" & $Min & ":" & $Sec)
        GUICtrlSetData($timeLeft, $Hour&":"&$Min&":"&$Sec)
    EndIf
EndFunc
Func GUIEvents()
    Exit 1
EndFunc
Link to comment
Share on other sites

I did a simple search just in this forum on the word countdown and found 50 hits, have you tried any of those in the past 2 days?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

yes i have.. they are not the things i need :( 

its not even exactly a countdown i need... i need to display time left .. say if it is 13:30pm ... and i need to know how much time is left till 14:00pm ... that would be 00:30min ... and keep counting it like 13:31 - 14:00 -> 00:29min ... and so on ... the countdowns ive seen they countdown timerdiff or such .. 

Link to comment
Share on other sites

  • Solution

ok i have figured it all out :) thank god ! 

here it is for others who will need similar thing ! 

#include <ButtonConstants.au3>
#include <SliderConstants.au3>
#include <GuiTab.au3>

#include <ComboConstants.au3>
#include <ListViewConstants.au3>
#include <Date.au3>
#include <EditConstants.au3>
#include <GUIListBox.au3>
#Include <GuiComboBox.au3>
#include <ProgressConstants.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <File.au3>
#include <UpdownConstants.au3>
#include <GuiListView.au3>
#include <Misc.au3>
#include <Inet.au3>
#include <TabConstants.au3>

Opt("GUIOnEventMode", 1)



#cs
00:00 - 04:00 - 08:00 - 12:00 - 16:00 - 20:00
#ce
Global $TimeTable[6] = ["00:00:00", "04:00:00", "08:00:00", "12:00:00", "16:00:00", "20:00:00"]
Global $Sec, $Min, $Hour, $Time
Global $countdown = $TimeTable[1] ;minutes for countdown
Global $seconds = $countdown * 60 ;convert to seconds
Global $hidden1, $optGUI, $transp_conf = 255, $GUI_SETUP=0


;~ MsgBox(0,"", _NowTime(4)) ;"YYYY/MM/DD[ HH:MM:SS]"
;~ If _NowTime(4) >= $TimeTable[0] Then MsgBox(0,  $TimeTable[5],  $TimeTable[0])
;~ MsgBox(0, "", _DateDiff("h", "04:00" ,_NowTime(4)))

$GUI = GUICreate("#cabal Nation War Alarm#", 300, 145, -1, -1, $WS_SYSMENU)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIEvents")
GUISetBkColor(0x000000)

$time = GUICtrlCreateLabel("00:00:00", 10, 10, 280, 80, $SS_CENTER)
GUICtrlSetFont($time, 50, -1, -1)
GUICtrlSetColor($time, 0x00b711)
$timeLeft = GUICtrlCreateLabel("00:00:00", 240, 95, 50, 20)
GUICtrlSetColor($timeLeft, 0xffae00)
CheckTime()

$options = GUICtrlCreateButton("Options", 5, 95, 50, 20) ; set alarm volume / set transparency to gui...
GUICtrlSetOnEvent($options, "OptionPanel")
Func OptionPanel()

    If $hidden1 = 1 Then
        GUISetState(@SW_SHOW, $optGUI)
    Else
        $hidden1 = 0
        $GUI_SETUP = 1
        $GUI_CORD = WinGetPos($GUI, "")
        $optGUI = GUICreate("Opacity", 150, 30, $GUI_CORD[0]+305 , $GUI_CORD[1]-30, -1, $WS_EX_TOOLWINDOW)
            $transp_conf = GUICtrlCreateSlider(5, 5, 140, 15)
            GUICtrlSetLimit(-1, 255, 0)
            GUICtrlSetData($transp_conf, 255)
        GUISetState(@SW_SHOW, $optGUI)
        GUISetOnEvent($GUI_EVENT_CLOSE, "optGUI")
        While WinGetState($optGUI, "") = 1
        WEnd
    EndIf
EndFunc
Func transp_set()
    WinSetTrans($GUI, "", GUICtrlRead($transp_conf))
EndFunc
$onTop = GUICtrlCreateButton("KeepTop", 60, 95, 70, 20)
GUICtrlSetOnEvent($onTop, "OnTopControl")
Func OnTopControl()
    If GUICtrlRead($onTop) = "KeepTop" Then
            WinSetOnTop($GUI, "", 1)
            WinSetTrans($GUI, "", 180)
            GUICtrlSetData($onTop, "Normal")
        ElseIf GUICtrlRead($onTop) = "Normal" Then
            WinSetOnTop($GUI, "", 0)
            WinSetTrans($GUI, "", 255)
            GUICtrlSetData($onTop, "KeepTop")
        EndIf
EndFunc

GUISetState()

AdlibRegister("CheckTime", 1000)
While 1
    If $GUI_SETUP = 1 Then WinSetTrans($GUI, "", GUICtrlRead($transp_conf))
WEnd
Func CheckTime() ;["00:00:00", "04:00:00", "08:00:00", "12:00:00", "16:00:00", "20:00:00"]
    GUICtrlSetData($time, _NowTime(5))
    If _NowTime(4) >= $TimeTable[0] Then
        If _NowTime(4) <= $TimeTable[1] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[1], _NowCalc()), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If _NowTime(4) >= $TimeTable[1] Then
        If _NowTime(4) <= $TimeTable[2] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[2], _NowCalc()), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If _NowTime(4) >= $TimeTable[2] Then
        If _NowTime(4) <= $TimeTable[3] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[3], _NowCalc()), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If _NowTime(4) >= $TimeTable[3] Then
        If _NowTime(4) <= $TimeTable[4] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[4], _NowCalc()), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If _NowTime(4) >= $TimeTable[4] Then
        If _NowTime(4) <= $TimeTable[5] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[5], _NowCalc()), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If _NowTime(4) >= $TimeTable[5] Then
        If _NowTime(4) <= $TimeTable[0] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[0], _NowCalc()), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
EndFunc
Func Sec2Time($nr_sec)
   $sec2time_hour = Int($nr_sec / 3600)
   $sec2time_min = Int(($nr_sec - $sec2time_hour * 3600) / 60)
   $sec2time_sec = $nr_sec - $sec2time_hour * 3600 - $sec2time_min * 60
   Return StringFormat('%02d:%02d:%02d', $sec2time_hour, $sec2time_min, $sec2time_sec)
EndFunc   ;==>Sec2Time
Func GUIEvents()
    Exit 1
EndFunc
Func optGUI()
    $hidden1 = 1
    GUISetState(@SW_HIDE, $optGUI)
EndFunc
Link to comment
Share on other sites

i got another problem i cannot solve :( 

when i add some hours... sometimes the countdown (small timer in corner) isnt working properly :( 

#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=clock_icon.ico
#AutoIt3Wrapper_Outfile=cabalNWA.exe
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#region includes -------->

#include <ButtonConstants.au3>
#include <SliderConstants.au3>
#include <GuiTab.au3>
#include <ComboConstants.au3>
#include <ListViewConstants.au3>
#include <Date.au3>
#include <EditConstants.au3>
#include <GUIListBox.au3>
#Include <GuiComboBox.au3>
#include <ProgressConstants.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <File.au3>
#include <UpdownConstants.au3>
#include <GuiListView.au3>
#include <Misc.au3>
#include <Inet.au3>
#include <TabConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("ExpandEnvStrings", 1)
Opt("GUICloseOnESC", 0)

OnAutoItExitRegister("CLEAR")



#cs
00:00 - 04:00 - 08:00 - 12:00 - 16:00 - 20:00
#ce
Global $TimeTable[6] = ["0:00:00", "4:00:00", "8:00:00", "12:00:00", "16:00:00", "20:00:00"]
Global $Sec, $Min, $Hour, $Time
Global $countdown = $TimeTable[1] ;minutes for countdown
Global $seconds = $countdown * 60 ;convert to seconds
Global $hidden1, $optGUI, $transp_conf = 255, $GUI_SETUP=0, $alarmON, $GMTchange = 0
Global $GMTchangeh=0, $GMTchangem=0, $GMTchanges=0


;~ MsgBox(0,"", _NowTime(4)) ;"YYYY/MM/DD[ HH:MM:SS]"
;~ If _NowTime(4) >= $TimeTable[0] Then MsgBox(0,  $TimeTable[5],  $TimeTable[0])
;~ MsgBox(0, "", _DateDiff("h", "04:00" ,_NowTime(4)))

$GUI = GUICreate("#cabal Nation War Alarm#", 300, 145, -1, -1, $WS_SYSMENU)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIEvents")
GUISetBkColor(0x000000)
$time = GUICtrlCreateLabel("00:00:00", 10, 10, 280, 80, $SS_CENTER)
GUICtrlSetFont($time, 50, -1, -1)
GUICtrlSetColor($time, 0x00b711)
$timeLeft = GUICtrlCreateLabel("00:00:00", 240, 95, 50, 20)
GUICtrlSetColor($timeLeft, 0xffae00)
CheckTime()
$options = GUICtrlCreateButton("Options", 5, 95, 50, 20) ; set alarm volume / set transparency to gui...
GUICtrlSetOnEvent($options, "OptionPanel")
Func OptionPanel()
    If $hidden1 = 1 Then
        GUISetState(@SW_SHOW, $optGUI)
    Else
        $hidden1 = 0
        $GUI_SETUP = 1
        $GUI_CORD = WinGetPos($GUI, "")
        $optGUI = GUICreate("Opacity", 150, 80, $GUI_CORD[0]+305 , $GUI_CORD[1]-30, -1, $WS_EX_TOOLWINDOW)
            $transp_conf = GUICtrlCreateSlider(5, 5, 140, 20)
            GUICtrlSetLimit(-1, 255, 0)
            GUICtrlSetData($transp_conf, 255)
            $alarmON = GUICtrlCreateCheckbox("Play Sound", 5, 30, 140, 20)
            $GMTchangeh = GUICtrlCreateInput("-7", 40, 50, 40, 20, $ES_READONLY)
            GUICtrlCreateUpdown($GMTchangeh, $UDS_ARROWKEYS)
            $GMTchangem = GUICtrlCreateInput("0", 80, 50, 40, 20, $ES_READONLY)
            GUICtrlCreateUpdown($GMTchangem, $UDS_ARROWKEYS)
            $GMTchanges = GUICtrlCreateInput("0", 115, 50, 40, 20, $ES_READONLY)
            GUICtrlCreateUpdown($GMTchanges, $UDS_ARROWKEYS)
        GUISetState(@SW_SHOW, $optGUI)
        GUISetOnEvent($GUI_EVENT_CLOSE, "optGUI")
        While WinGetState($optGUI, "") = 1
        WEnd
    EndIf
EndFunc
Func transp_set()
    WinSetTrans($GUI, "", GUICtrlRead($transp_conf))
EndFunc
$onTop = GUICtrlCreateButton("KeepTop", 60, 95, 70, 20)
GUICtrlSetOnEvent($onTop, "OnTopControl")
Func OnTopControl()
    If GUICtrlRead($onTop) = "KeepTop" Then
            WinSetOnTop($GUI, "", 1)
            WinSetTrans($GUI, "", 180)
            GUICtrlSetData($onTop, "Normal")
        ElseIf GUICtrlRead($onTop) = "Normal" Then
            WinSetOnTop($GUI, "", 0)
            WinSetTrans($GUI, "", 255)
            GUICtrlSetData($onTop, "KeepTop")
        EndIf
EndFunc

GUISetState()

AdlibRegister("CheckTime", 1000)
While 1
    If $GUI_SETUP = 1 Then WinSetTrans($GUI, "", GUICtrlRead($transp_conf))
WEnd
Func CheckTime() ;["00:00:00", "04:00:00", "08:00:00", "12:00:00", "16:00:00", "20:00:00"]
;~  If GUICtrlRead($time) = "24:00:00" Then GUICtrlSetData($time, "00:00:00")


$checking = _DateAdd("h", GUICtrlRead($GMTchangeh), @YEAR & "/"&@MON&"/"&@MDAY&" "&_NowTime(5))
Local $MyDate, $MyTime
_DateTimeSplit($checking, $MyDate, $MyTime)
    GUICtrlSetData($time, $MyTime[1]&":"&$MyTime[2]&":"&$MyTime[3]);, GUICtrlRead($GMTchange)&":38:00"))
    If GUICtrlRead($alarmON) = $GUI_CHECKED Then
        If GUICtrlRead($time) = $TimeTable[0] Or GUICtrlRead($time) = $TimeTable[1] Or GUICtrlRead($time) = $TimeTable[2] Or GUICtrlRead($time) = $TimeTable[3] Or GUICtrlRead($time) = $TimeTable[4] Or GUICtrlRead($time) = $TimeTable[5] Then
            $sSnd = RegRead("HKCU\AppEvents\Schemes\Apps\.Default\.Default\.Default", "")
            SoundPlay($sSnd,1)
        EndIf
    EndIf
    If GUICtrlRead($time) >= $TimeTable[0] Then
        If GUICtrlRead($time) <= $TimeTable[1] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[1], @YEAR & "/"&@MON&"/"&@MDAY&" "&GUICtrlRead($time)), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If GUICtrlRead($time) >= $TimeTable[1] Then
        If GUICtrlRead($time) <= $TimeTable[2] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[2], @YEAR & "/"&@MON&"/"&@MDAY&" "&GUICtrlRead($time)), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If GUICtrlRead($time) >= $TimeTable[2] Then
        If GUICtrlRead($time) <= $TimeTable[3] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[3], @YEAR & "/"&@MON&"/"&@MDAY&" "&GUICtrlRead($time)), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If GUICtrlRead($time) >= $TimeTable[3] Then
        If GUICtrlRead($time) <= $TimeTable[4] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[4], @YEAR & "/"&@MON&"/"&@MDAY&" "&GUICtrlRead($time)), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If GUICtrlRead($time) >= $TimeTable[4] Then
        If GUICtrlRead($time) <= $TimeTable[5] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[5], @YEAR & "/"&@MON&"/"&@MDAY&" "&GUICtrlRead($time)), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
    If GUICtrlRead($time) >= $TimeTable[5] Then
        If GUICtrlRead($time) <= $TimeTable[0] then
            $stringFix = StringReplace(_DateDiff('s', @YEAR & "/"&@MON&"/"&@MDAY&" "&$TimeTable[0], @YEAR & "/"&@MON&"/"&@MDAY&" "&GUICtrlRead($time)), "-", "")
            GUICtrlSetData($timeLeft, Sec2Time($stringFix))
        EndIf
    EndIf
EndFunc
Func Sec2Time($nr_sec)
   $sec2time_hour = Int($nr_sec / 3600)
   $sec2time_min = Int(($nr_sec - $sec2time_hour * 3600) / 60)
   $sec2time_sec = $nr_sec - $sec2time_hour * 3600 - $sec2time_min * 60
   Return StringFormat('%02d:%02d:%02d', $sec2time_hour, $sec2time_min, $sec2time_sec)
EndFunc   ;==>Sec2Time
Func GUIEvents()
    Exit 1
EndFunc
Func optGUI()
    $hidden1 = 1
    GUISetState(@SW_HIDE, $optGUI)
EndFunc
Func CLEAR()
    If $GUI_SETUP = 1 Then
        FileDelete("data.nwa")
        FileWrite("data.nwa", GUICtrlRead($GMTchange))
    EndIf
EndFunc

Func _SubTractTime($sTime1, $sTime2)
    Local $aSplit1 = StringSplit($sTime1, ':')
    Local $aSplit2 = StringSplit($sTime2, ':')
    If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0)
    Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3])))
    Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3])))
    If $iTotal1 >= $iTotal2 Then
        $iSubTotal = $iTotal1 - $iTotal2
    Else
        $iSubTotal = $iTotal2 - $iTotal1
    EndIf
    Local $iHour = Int(($iSubTotal / 3600))
    $iSubTotal = $iSubTotal - (($iHour * 3600))
    Local $iMin = Int($iSubTotal / 60)
    $iSubTotal = $iSubTotal - ($iMin * 60)
    Local $iSec = Int($iSubTotal)
    Return StringFormat('%02d', $iHour) & ':' & StringFormat('%02d', $iMin) & ':' & StringFormat('%02d', $iSec)
EndFunc

Func _AddTime($sTime1, $sTime2)
    Local $aSplit1 = StringSplit($sTime1, ':')
    Local $aSplit2 = StringSplit($sTime2, ':')
    If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0)
    Local $aAddTime[4] = ['', 0, 0, 0]
    For $iCount = UBound($aSplit1) - 1 To 2 Step - 1
        $aAddTime[$iCount] += Int($aSplit1[$iCount]) + Int($aSplit2[$iCount])
        Do
            If $aAddTime[$iCount] > 59 Then
                $aAddTime[$iCount - 1] += 1
                $aAddTime[$iCount] = StringFormat('%02d', String($aAddTime[$iCount] - 60))
            EndIf
        Until Int($aAddTime[$iCount]) < 60
    Next
    $aAddTime[1] += Int($aSplit1[1]) + Int($aSplit2[1]);Weird couldn't use StringFormat correctly here
    Return StringFormat('%02d', $aAddTime[1]) & ':' & $aAddTime[2] & ':' & $aAddTime[3]
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...