Below is my code:
var date = new Date().toLocaleString("en-US", { timeZone: "Asia/Kolkata" });
var n = date.getDay();
Trying to convert data into IST.
without .toLocaleString
.getday
is working perfectly. But when used getting below error:
TypeError: date.getDay is not a function at Object. (D:\Learning\node-course\web-server\src\app.js:12:14) at Module._compile (internal/modules/cjs/loader.js:1200`enter code here`:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10) at Module.load (internal/modules/cjs/loader.js:1049:32) at Function.Module._load (internal/modules/cjs/loader.js:937:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47
Is there any better way to convert date into IST and find the day as well?