Ethernet and Coffee

Javascript iso8601 time stamp with milliseconds and local TZ offset

''use strict'';

var ts = function(){
  // generate an iso8601 timestamp in local time with milliseconds
  // return value looks like: 2017-04-04T10:44:17.224

  var date = new Date(new Date().getTime() - new Date().getTimezoneOffset()*60*1000).toISOString().substr(0,23); 
  return date;
};


document.writeln(ts() + ",iso8601-timestamp.js");