i have a discord bot with a timezones command and it's currently run off of VSCode on my computer. Unfortunately, the timezones command only works with the time when of when i start the bot, not when i call the command. I've attempted to wrap the "const/var now = new Date();" in a function, both standard and arrow functions but that makes anything that requires the date to do math (converting the time) undefined and returns an error as the variables are now not defined b/c they are wrapped in a function. The functions are commented out so it at least sort of works. here's my current code:
//function getTime() {
//const getTime = () => {
var now = new Date();
var timeHours;
var timeMinutes;
timeHours = now.getUTCHours();
timeMinutes = now.getUTCMinutes();
var day = now.getDay();
var dayOfMonth = now.getDate();
var month = now.getMonth();
var ET = timeHours - 4;
var uzbek = timeHours + 5;
var meridiemET = " AM";
var meridiemUZ = " AM";
var ETm = timeHours - 4;
var year = now.getFullYear();
//}
//getTime();
//timezone math
if(ET>12) {
ET=ET-12;
meridiemET = " PM";
}
if(ET<0) {
ET=ET+12;
meridiemET = " PM";
}