Action Directory / Date & Time Stamp

Install

Shared by Stan, @packer2020

Script

// Insert day yyyy-mm-dd
var now = new Date();
var min = now.getMinutes();
var hh = now.getHours();
var dd = now.getDate();
var mm = now.getMonth()+1;
var yyyy = now.getYear()+1900;

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

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

var today = +yyyy+'-'+mm+'-'+dd+', '+hh+':'+min+' ';
editor.replaceSelection( today );

/*
var timestamp = function() {
	function pad2(n) { return n < 10 ? '0' + n : n };

	var date = new Date();
	var timestamp = date.getFullYear().toString() + pad2(date.getMonth() + 1)
	+ pad2( date.getDate()) + pad2( date.getHours() ) + pad2( date.getMinutes() )
	+ pad2( date.getSeconds() );

	return( timestamp );
}

editor.replaceSelection( timestamp() );

*/