Using the current date and time in your bot application can be helpful—whether you're displaying it to users or passing it as a variable.

In this guide, you'll learn how to use the utcNow() expression to retrieve the current date in UI Builder.

The utcNow() expression can be used anywhere in your conversation flow to get the current date and time in UTC format. You'll also learn how to:

  1. Format this output
  2. Adjust it for different time zones

Prerequisites

Before following this guide, you should be familiar with:


Storing Today’s Date in a Variable

First, we’ll create a trigger in UI Builder that responds to specific user phrases, and then store the current date in a variable that can be used throughout the conversation flow.

<aside> 💡

In this example, we'll create a trigger to return today's date, but you can adapt these steps to your own use case, flow, or custom event.

</aside>