Almost like Node.js - How to format a date string in UTC, as the following is already the format that I want (both of them):
var x = new Date();
console.log(x);
var u = x.toISOString();
console.log(u);
However, the output is in UTC time zone & format (as indicated by the trailing Z), whereas,
I just need it in the local time zone. How to do that?
I've tried .toLocaleDateString()
, toLocaleTimeString()
, toLocaleFormat("%Y-%m-%d %H:%M:%S")
, toString("yyyyMMddHHmmss")
, etc, etc, but none is working. pls help. thx.