GetDatetime
Returns the current date and/or time.
GetDatetime(
format: Literal["datetime", "date", "time"],
timezone: str,
weekday: str
)
Where:
- format: Indicates what value to return (i.e., either the date, time, or both).
- timezone: Indicate a timezone identifier. If a timezone argument is not provided, the actor's timezone_identifier is used. If an event doesn't have an actor, then the UTC timezone is used to get the current date and time. A list of timezone identifiers can be found here.
- weekday: Adds the weekday to the end of the date/time if set to "true."
Example 1 (Date)
The code below sets a variable name "date_" and adds the date to it using the GetDatetime action. The SendMessage action outputs the result in the Sandbox chat. Ensure you set up an event subscription to activate this Skill when sending a message in the Sandbox chat.
{{set(name="date_", value=GetDatetime(format= "date"))}}
{{SendMessage(message=date_)}}
Response: 2024-01-19
Example 2 (Time)
The code below sets a variable name "time_" and adds the time to it using the GetDatetime action. The SendMessage action outputs the result in the Sandbox chat. Ensure you set up an event subscription to activate this Skill when sending a message in the Sandbox chat.
{{set(name="time_", value=GetDatetime(format= "time"))}}
{{SendMessage(message=time_)}}
Response: 09:47:19.479534
Example 3 (Date/Time - Timezone Identifier)
The code below sets a variable name "datetime_" and adds the date/time to it using the GetDatetime action. The SendMessage action outputs the result in the Sandbox chat. Ensure you set up an event subscription to activate this Skill when sending a message in the Sandbox chat.
{{set(name="datetime_", value=GetDatetime(format= "datetime", timezone="America/Los_Angeles"))}}
{{SendMessage(message=datetime_)}}
Response: 2024-01-19T09:47:19.479534-07:00
Example 4 (Date/Time - Weekday)
The code below sets a variable name "datetime_" and adds the date/time to it using the GetDatetime action. The weekday is also added to the end of the date/time. The SendMessage action outputs the result in the Sandbox chat. Ensure you set up an event subscription to activate this Skill when sending a message in the Sandbox chat.
{{set(name="datetime_", value=GetDatetime(format= "datetime", timezone="America/Los_Angeles", weekday="true"))}}
{{SendMessage(message=datetime_)}}
Response: 2024-01-19T09:47:19.479534-07:00, Thursday
Updated 5 months ago