Current Date and Time in ISOish Format accounting for timezones
JavascriptGuide
Code
Javascript code to get timestamp in current timezone of the form YYYY-MM-DD hh:mm:ss
let timestamp = new Date().toLocaleString('sv');
Result
This produces the result:
Problem
This is to get around the fact that the .toISOString() method:
let timestamp = new Date().toISOString().replace("T"," ").slice(0,19);
which produces a timestamp in a similar format:
cannot handle timezones and is always limited to UTC time.
Explanation
sv is the Swedish country code. They style their dates in the format YYYY-MM-DD hh:mm:ss