Timestamp
Shared by @_mmmartin
Outputs a timestamp in yyyyMMddHHmmss format.
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() );