Date
Insert today's date and current time

Script key: Insert today’s date and current time

Posted by @reidpooper

Install

Details

Label Date
Voice Over Insert today's date and current time
Script
var now = new Date();
var dd = now.getDate();
var mm = now.getMonth()+1;
var yyyy = now.getFullYear();
var time = function(){
  var d = new Date(),
      h = (d.getHours()<10?'0':'') + d.getHours(),
      m = (d.getMinutes()<10?'0':'') + d.getMinutes();
  return h + ':' + m;
};

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

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

var today = mm+'/'+dd+'/'+yyyy+' @'+time();
var selRange = getSelectedRange();
setSelectedText(today);
setSelectedRange(selRange[0]+today.length,0);

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus