Time
Time

Script key: Time

Posted by @GuyWritesCode

Install

Details

Label Time
Voice Over Time
Script
var selRange = getSelectedRange();

var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var AMOrPM = h > 12 ? "PM " : "AM ";
h = h > 12 ? h - 12 : h == 0 ? 12 : h;
m = ("0"+m).slice(-2);
var time = h + ":" + m + " " + AMOrPM;
setSelectedText(time);
setSelectedRange(selRange[0]+time.length,0);

Advanced

Keyboard shortcut Command+t
Hide key Yes

Discussion

comments powered by Disqus