Action Directory / Timestamp

Install

Outputs a timestamp in yyyyMMddHHmmss format.

Shared by @_mmmartin

Script

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() );