Simple Count Down timer and FormatTime weird behavior Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
djvj11
Posts: 15
Joined: 21 Jun 2014, 01:30

Simple Count Down timer and FormatTime weird behavior  Topic is solved

21 Mar 2019, 22:20

I'm trying to figure out why when I put in to countdown 1800 seconds I get over 12 hrs of time counting down. But when I put in 2 hours (7200) it is correct? It's actually anything over 3600 seconds, once it reaches less than 1 hour left, it changes to 12 hours!

I noticed the hours becomes 00, which the format is converting it to 12 instead. How do I keep this as 0 and not show 12?

Code: Select all

#SingleInstance, force

; initSecs := 7200 ; number of seconds to wait
initSecs := 1800 ; number of seconds to wait

Gui, 99:+AlwaysOnTop +Disabled -SysMenu +Owner
Gui, 99:Font,s20 bold,Verdana
Gui, 99:Add, Text, w140 vTX , %initSecs%
Gui, 99:Show
Gui, 99:Flash

loop % initSecs-1 {        
    GuiControl,99:,TX,% Frmt(--initSecs)
    sleep, 1000
}
Gui, 99:Destroy

return

Frmt(secs) {
    time = 20000101
    time += %secs%, seconds
    FormatTime, hmmss, %time%, h:mm:ss
    return hmmss
}

esc::
ExitApp
NM, I got it, it was the 12-hr format, once I put HH instead of hh, it shows 00 instead!
User avatar
lvalkov
Posts: 58
Joined: 08 Mar 2019, 16:39

Re: Simple Count Down timer and FormatTime weird behavior

23 Mar 2019, 10:13

Modify your formatting template to H:mm:ss.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Lamron750, terraformars and 275 guests