NodeJS return time in UTC. (0.00) as I understand there are two ways to store/set default timezone for NodeJS.
First set in code using process.env.tz. another one is set date default timezone while you start the server.
1.set in code using process.env.tz sample below
process.env.TZ = 'Asia/Calcutta'
2. another way is to set timezone while you run server js.
PM2 is best for making NodeJS to production.
Here I show you how to set NodeJS environment and timezone while run the server using pm2
NODE_ENV=production TZ='Asia/Calcutta' pm2 start app.js --name [PROJECT_NAME]
In the above example, I use NODE_ENV to setting your environment. Like production, testing, development.
TZ use to set as default timezone for NodeJS.
PM2 start app.js use to start app.js.
–name [project_name] use for giving naming convention to this process while I checklist of PM2 services status at that time its useful.
I hope you like this article. Keep visiting my website for more upcoming articles. If you need any help with Set default timezone in NodeJSÂ you can contact me. You can ask me questions in comments also. You can connect me on social media as well links are below in the footer section. Keep connected. Happy Coding.