---
title: "Using dates and date formats in ScriptBuilder"
slug: "using-dates-and-date-formats-in-scriptbuilder"
updated: 2025-12-31T21:36:07Z
published: 2025-12-31T21:36:07Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://success.panaya.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using dates and date formats in ScriptBuilder

## Overview

Sometimes you need to use a **date** in ScriptBuilder — for example, when setting parameters or passing a date to another step. A common question is how to format that date, for example to MM.DD.YYYY.

This article explains **the simplest and most reliable way** to do this, and also clarifies **when you should (and should not) use**[**AI prompts.**](https://success.panaya.com/docs/ai-prompt)

---

> [!TIP]
> **Guideline:**
> 
> If something can be done using [ScriptBuilder functions](https://success.panaya.com/docs/automation-functions), you should always use those functions instead of AI prompts.

## Recommended Approach

Use ScriptBuilder’s built-in date functions.

### Step 1: Get tomorrow’s date

Use the `today()` function and add 1:

*today() + 1*

This reliably returns tomorrow’s date.

> **Note**
> 
> The date format that will be used is defined in the [Script Settings](https://success.panaya.com/docs/scriptbuilder-settings#:~:text=Script%20Settings-,Date%20Format,-This%20date%20format)

---

If ScriptBuilder does not support the required date format you can use the following method:

### Step 2: Format the date as MM.DD.YYYY

Use the following formula to format the date:

= month_of({x}) + '.' + day_of({x}) + '.' + year_of({x})

Where `{x}` is the date value (for example, the result of `today() + 1`).

### Example

If today is `12/09/2025`(December 9th, 2025), the formula will return:

*12.10.2025*

This approach is **accurate**, **predictable** and **independent of AI**.

---

## Alternative Approach

You *can* combine ScriptBuilder and AI, but this is **less reliable**.

### How it works:

1. Use ScriptBuilder to calculate tomorrow’s date:

*today() + 1*
2. Pass that date into an AI prompt with a request like:

*“Change the date format of {x} to MM.DD.YYYY”*

> [!WARNING]
> **Good to Know!**
> 
> ScriptBuilder functions are not supported directly in [AI prompts](/v1/docs/ai-prompt), but parameters are - two separate instructions need to be used, one for getting the date into a parameter (using the function), and another one for passing the parameter (date) into the AI prompt.

### Why this is not ideal:

- AI is unnecessary for simple formatting
- Adds complexity
- Can lead to inconsistent results

> [!TIP]
> **Recommendation**: Use this only if formatting cannot be achieved with functions.

---

## Why AI is not the right tool for dates

If you try to use an AI prompt like *“give me tomorrow’s date”*, you may get an incorrect result (for example, a date from 2023).

That’s because:

- AI does **not necessarily know what today’s/tomorrow’s date is**
- AI is **not reliable for date calculations**
- Dates are **deterministic** and should be handled by functions

---

## Summary

- Do not use AI to calculate a date like today’s or tomorrow’s date
- Use `today()` and other date functions in ScriptBuilder
- Format dates using concatenation and the `day_of()`, `month_of()`, and `year_of()` functions

> [!TIP]
> **Best practice:**
> 
> Deterministic logic (like dates) should always be handled with ScriptBuilder functions, not AI.
