Here is how you can add time with ahk

Put simple Tips and Tricks that are not entire Tutorials in this forum
mdimovic
Posts: 3
Joined: 27 Feb 2018, 06:48

Here is how you can add time with ahk

Post by mdimovic » 27 Feb 2018, 07:12

Code: Select all

ftime := "12:15 PM"
RegExMatch(ftime, "(\d\d):(\d\d) (PM)?", t)
if t3 ; PM
    t1 += 12
	
if t1 = 24
t1 += -12

time := A_YYYY A_MM A_DD t1 t2  ; or any valid date:  "19700101" t1 t2
time += 15, min
MsgBox % "Unformatted: " SubStr(time, 9, 4)
FormatTime time, %time%, hh:mm tt
MsgBox % "Formatted: " time

guest3456
Posts: 3477
Joined: 09 Oct 2013, 10:31

Re: Here is how you can add time with ahk

Post by guest3456 » 27 Feb 2018, 09:47

mdimovic wrote:

Code: Select all

time += 15, min
docs reference for the line above:

https://autohotkey.com/docs/commands/EnvAdd.htm

:)
Last edited by guest3456 on 27 Feb 2018, 10:12, edited 2 times in total.


Post Reply

Return to “Tips and Tricks (v1)”