var ts = new Date();
console.log(ts.toDateString());
# Thu Sep 02 2021
console.log(ts.toGMTString());
# Thu, 02 Sep 2021 02:36:02 GMT
console.log(ts.toISOString());
# 2021-09-02T02:36:02.097Z
console.log(ts.toJSON());
# 2021-09-02T02:36:02.097Z
console.log(ts.toLocaleDateString());
# 9/2/2021
console.log(ts.toLocaleTimeString());
# 2:36:02 PM
console.log(ts.toLocaleString());
# 9/2/2021, 2:36:02 PM
console.log(ts.toString());
# Thu Sep 02 2021 14:36:02 GMT+1200 (New Zealand Standard Time)
console.log(ts.toTimeString());
# 14:36:02 GMT+1200 (New Zealand Standard Time)
console.log(ts.toUTCString());
# Thu, 02 Sep 2021 02:36:02 GMT
var functions = ["toDateString", "toGMTString", "toISOString", "toJSON", "toLocaleDateString", "toLocaleTimeString", "toLocaleString", "toString", "toTimeString", "toUTCString"];
var ts = new Date();
var code = $("#jsExample");
for (i in functions) {
fun = functions[i];
code.append("console.log(ts." + fun + "());\n");
code.append("# " + ts[fun]() + "\n\n");
console.log(fun);
}