Time Variables
When using the $(time.timezone)
variable, always use IANA Timezone names. These are standardized identifiers like "America/New_York" or "Europe/London". Do not use abbreviations like EST or GMT, as they can be ambiguous.
Find the correct IANA Timezone name for your location at https://nodatime.org/TimeZones.
Overview
StreamElements Chatbot offers two powerful time-related variables:
$(time.timezone)
: Displays the current time in a specified timezone$(time.until)
: Creates a countdown to a specified UTC timestamp
These variables allow you to enhance your stream chat with real-time clock displays and event countdowns.
$(time.timezone)
Usage
$(time.timezone <timezone>)
If no timezone is provided, the variable will return UTC time.
Parameters
<timezone>
: (Optional) The desired timezone in IANA format. If omitted, UTC is used.
A list of valid IANA timezones can be found at Nodatime Timezones.
Examples
-
Display time in New York:
The current time in New York is $(time.timezone America/New_York)
-
Display UTC time:
The current UTC time is $(time.UTC)
$(time.until)
Usage
$(time.until <timestamp>)
Parameters
<timestamp>
: The target UTC timestamp in ISO 8601 format.
Examples
-
Countdown to a specific time today:
Next stream starts in $(time.until 19:00)
-
Countdown to a future date and time:
Upcoming event in $(time.until 2024-09-20T19:00:00-03:00)
Common Use Cases
-
Displaying Local Time: Use
$(time.timezone)
to show the streamer's local time or the time in different viewers' locations. -
Event Countdowns: Use
$(time.until)
to create excitement for upcoming streams, game releases, or special events. -
Multi-Timezone Scheduling: Display multiple timezones simultaneously for international audiences.
-
Dynamic Stream Information: Incorporate time variables into stream titles or chat commands to provide real-time updates.
Best Practices
- Always use IANA timezone names with
$(time.timezone)
to ensure accuracy and avoid ambiguity. - Use clear and consistent timestamp formats with
$(time.until)
to ensure accuracy. - Consider creating custom commands that combine both variables for comprehensive time information.
Troubleshooting
Common Errors
-
Invalid Timezone:
- Error message:
unknown time zone lol
- Solution: Double-check the timezone name against the Nodatime Timezones list. Ensure you're using the full IANA name (e.g., "America/Los_Angeles" instead of "PST").
- Error message:
-
Invalid Timestamp Format:
- Error message:
parsing time "19:00:00-03:00" as "2006-01-02T15:04:05Z07:00": cannot parse "19:00:00-03:00" as "2006"
- Solution: Ensure your timestamp follows the ISO 8601 format.
- Error message:
FAQ
Q: Can I use these variables in custom commands?
A: Yes, you can incorporate these time variables into your custom chat commands for added functionality.
Q: How often do the time variables update? A: The variables update in real-time with each use, providing current information every time they're called.
Q: Can I use abbreviations like EST or GMT with $(time.timezone)?
A: No, always use full IANA timezone names like "America/New_York" or "Europe/London" to avoid ambiguity and ensure correct time display.
Q: Can I use these variables to schedule automated messages?
A: While the variables themselves don't schedule messages, you can use them in combination with StreamElements' scheduling features to create time-based automated messages.