HH:MM
Insert current time with AM/PM

Script key: Insert current time with AM/PM

Posted by @neighbortim

Install

Details

Label HH:MM
Voice Over Insert current time with AM/PM
Script
var now = new Date();
var hh =now.getHours();
var mm = now.getMinutes();
var ampm = hh >= 12 ? 'PM' : 'AM';

if(hh<10) {
    hh='0'+hh
} else if (hh>12) {
    hh=hh-12
}

if(mm<10) {
    mm='0'+mm
} 

var time = hh+':'+mm+' '+ampm+' ';
var selRange = getSelectedRange();
setSelectedText(time);
setSelectedRange(selRange[0]+9,0);

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus