add date function

This commit is contained in:
David Daily 2022-03-29 14:32:47 -05:00
parent 5ba0c5a215
commit e851dc5c3c
1 changed files with 12 additions and 3 deletions

View File

@ -12,7 +12,7 @@ GetDateTime(lang)
UTCTimestamp := A_NowUTC ; Grab the current time and date UTCTimestamp := A_NowUTC ; Grab the current time and date
UTCFormatStr := "yyyy-MM-dd" ; The Date UTCFormatStr := "yyyy-MM-dd" ; The Date
FormatTime, DateStr, %UTCTimestamp%, %UTCFormatStr% ; format it to make it look like the Date we want FormatTime, DateStr, %UTCTimestamp%, %UTCFormatStr% ; format it to make it look like the Date we want
UTCFormatStr := "H:mm' GMT'" ; The time UTCFormatStr := "H:mm'Z'" ; The time
FormatTime, TimeStr, %UTCTimestamp%, %UTCFormatStr% ; Format the string to be better FormatTime, TimeStr, %UTCTimestamp%, %UTCFormatStr% ; Format the string to be better
if (lang = "en") if (lang = "en")
{ {
@ -23,6 +23,16 @@ GetDateTime(lang)
{ {
Return DateStr " um " TimeStr Return DateStr " um " TimeStr
} }
if (lang = "ISO8601")
{
Return DateStr "T" TimeStr
}
if (lang = "date")
{
Return DateStr
}
} }
GetInfo(xID) GetInfo(xID)
@ -104,8 +114,7 @@ ini_write(location, inKey, inValue)
replacement := inKey . "=" . inValue replacement := inKey . "=" . inValue
tempini := RegExReplace(tempini, needle, replacement,, 1) tempini := RegExReplace(tempini, needle, replacement,, 1)
tempini := RegExReplace(tempini, "\R+\R", "`r`n") tempini := RegExReplace(tempini, "\R+\R", "`r`n")
WinWaitNotActive, GloVar.ini
FileAppend, %tempini%, tempini ; Append the fixed ini to a new file FileAppend, %tempini%, tempini ; Append the fixed ini to a new file
FileCopy, tempini, %location%, 1 ; Copy the file over, overwriting existing contents FileCopy, tempini, %location%, 1 ; Copy the file over, overwriting existing contents
FileDelete, tempini ; Delete the fixed temporary ini FileDelete, tempini ; Delete the fixed temporary ini
} }