My Time/Datestamp Applescript

Here's the .scpt file that will open in Script Editor on Mac. You can set it up as a keystroke (CMD-Shift-D for me) in FastScripts (free for up to 10 scripts).

-- yar2050 (Dan Rosenstark)'s favorite date format
-- 2017-08-03 update
on fillInZero(int)
if (int < 10) then set int to "0" & int
return int as string
end fillInZero

set theDate to (current date)
set theHour to fillInZero(hours of (theDate) as integer)
set theMinutes to fillInZero(minutes of (theDate) as integer)
tell theDate to get (its month as integer)
set theMonth to fillInZero(result)
set theDay to fillInZero(day of theDate)
tell (theDate) to get (its year as integer) & "-" & (theMonth) & "-" & theDay & " " & (theHour) & ":" & theMinutes
set date_ to (result as string)
tell application "System Events"
set frontmostApplication to name of the first process whose frontmost is true
end tell


tell application frontmostApplication
delay 0.2 -- I have no idea why this is necessary
activate
tell application "System Events"
if (frontmostApplication = "Evernote") then
keystroke "h" using {command down, shift down}
keystroke "b" using {command down}
keystroke date_
keystroke "b" using {command down}
else
keystroke date_
end if
end tell
end tell

DansTimeStamp.scpt