Q: Getting current date and time with specific time zone for discord bot I am trying to get the current date and time from a time zone (NZT) but am unsure how. Currently when I make a new date it's time zone is set to GMT-0 (or something like that, anyway not what I want). I need to be able to get the date and time in NZT (bot isn't run in New Zealand so if that's an issue then...) All help appreciated. Thanks!

A: I would advise you using luxon.
It is one of the best date-time dependencies and far better than the JS-Inbuilt date-time system.
The following code should give you what you need:
const {
    DateTime
} = require('luxon');


var local = DateTime.local();
var rezoned = local.setZone("Pacific/Auckland");

If you really need the date Object to be formatted as adefault JavaScript Object, you can use the following code:
const {
    DateTime
} = require('luxon');


function localDate() {

    let local = DateTime.local(); //initialize luxon Date-Object
    let rezonedString = local.setZone("Pacific/Auckland").toString(); //set timezone of Date-Object and convert to string
    var dateString = rezonedString.slice(0, -10) + "z"; //trim string to create default JavaScript Date-OBject
    var today = new Date(dateString); //convert dateString to JS Date-Object

    //fix Month index
    today.setMonth(today.getMonth() + 1);
    return today;

}

//set variable today to localDate in NZ
var today = localDate();


Note: this is a solution for JavaScript! This is because you tagged discord.js, which is a javaScript Framework for the Discord API

