Published
August 22, 2024
Updated
August 31, 2024
Part of any good system is a whole lot of documentation, including logging events.
We do this a lot, and because our customers are international, it's important to use an unambiguous date format, like ISO-8601.
While 1/3/24
and 3/1/24
aren't clear, 2024-03-01
clearly indicates year, month and day.
And, importantly, it's sortable as a string.
But it's a pain to type.
Hotkey for ISO Dates
We use two variations;
ISO Date, with CTRL + ;
Simply press CTRL+; in any app to insert the ISO-8601 formatted date for today.
e.g. 2024-09-13
; Define the hotkey for Ctrl + ;
^;:: {
; Get the current date in yyyy-MM-dd format
currentDate := FormatTime(A_Now, "yyyy-MM-dd")
; Send the current date to the active window
SendText(currentDate)
}
Date + Weekday
For extra clarity, we've programmed CTRL+SHIFT+; to add the 3-letter weekday;
e.g. 2024-08-31 Mon
; Define the hotkey for Ctrl + Shift + ;
^+;:: {
; Get the current date and time in ISO 8601 format
currentDate := FormatTime(A_Now, "yyyy-MM-dd")
currentDateTime := FormatTime(A_Now, "yyyy-MM-ddTHH:mm:ss")
; Get the day of the week in three-letter format
dayOfWeek := FormatTime(A_Now, "ddd")
; Send the current date and time, plus day of the week to the active window
SendText(currentDate " " dayOfWeek)
}
Future
- We might add a variation for the GMT datetime