Date & Time
time
$time[]
The function $time[] sets the timezone used by the date and time functions ($hour, $minute, $second, $date, $day, $month, $year, $creationDate, …) evaluated afterwards in the command.
Syntax
$time[timezone]
Parameters
| Parameter | Description |
|---|---|
timezone |
Required - A TZ database timezone name (e.g., Europe/Paris, America/New_York). |
Return Value
None (empty string). An error is raised if the timezone is empty or unknown.
Examples
Set the timezone
$time[Europe/Paris]
It is $hour:$minute:$second in Paris.
Date in a given timezone
$time[America/New_York]
📅 $date, hour: $hour
Notes
- Used on its own (
$timewith no argument) the function is invalid;$time[]with an empty value raisesTimezone is required. - Surrounding spaces in the timezone name are ignored; the name is otherwise case-sensitive (
europe/parisis unknown). Without$time, date and time functions use UTC. - An unknown name raises
Unknown TZ database timezone: <name>. - For the individual values, use
$hour,$minuteand$second.$getTimestampis not affected by the timezone. - For a Unix timestamp, use
$getTimestamp[].
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.