This function sets the timezone used by subsequent date and time functions within your command. Think of it as changing the "local time" for your bot's calculations.
Important: This function only affects date and time calculations after it's called within the command's logic.
To find a valid timezone name, refer to the comprehensive list on Wikipedia. Use the values from the "TZ database name" column.
Replace Region/City with the desired timezone. For example, Europe/Zurich or America/Los_Angeles.
Example:
This example demonstrates how $timezone changes the output of the $hour function.
In this example:
- First,
$houris called without a specified timezone, so it returns the hour in UTC (Coordinated Universal Time). - Then,
$timezone[Europe/Zurich]sets the timezone to Zurich. - Finally,
$houris called again, now returning the hour in the Europe/Zurich timezone, which is UTC+2 (or UTC+1 during standard time).