Hello,
AHK commands use literal strings unless noted otherwise. Thus, you are using
localtime as a string instead of a variable. This is quickly understood by examining an
example.
Code: Select all
#Requires AutoHotkey v1.1.33.11
localTime := "20200101101010"
FormatTime t1, localTime , h tt
FormatTime t2, abcdefg , h tt
FormatTime t3, , h tt
FormatTime t4, % A_Now , h tt
FormatTime t5, 20200101101010, h tt
FormatTime t6, % localTime , h tt
MsgBox % t1 "`n" t2 "`n" t3 "`n" t4 "`n" t5 "`n" t6
YYYYMMDDHH24MISS
If blank or omitted, it defaults to the current local date and time. Otherwise, specify all or the leading part of a timestamp in the YYYYMMDDHH24MISS format. If the date and/or time portion of the timestamp is invalid -- such as February 29th of a non-leap year -- the date and/or time will be omitted from OutputVar. Although only years between 1601 and 9999 are supported, a formatted time can still be produced for earlier years as long as the time portion is valid.
Source: FormatTime - Syntax & Usage | AutoHotkey v1