# Create Yesterday's Date

{% embed url="<https://youtu.be/CEo-KtvHSKA?si=PXZIayTaZ8fzOMaq>" %}

## Creating Custom Field for Yesterday's Date in HubSpot

### Overview

This document provides instructions on creating a custom field in HubSpot that displays yesterday's date. The custom field will be based on the "Today's Date" field created in a previous video.

### Prerequisites

* HubSpot account
* Access to HubSpot settings

### Step-by-Step Guide

#### 1. Navigate to HubSpot Settings

* Log in to your HubSpot account.
* In the top-right corner, click the **Settings** icon.

#### 2. Access Properties

* In the left sidebar, click **Properties**.

#### 3. Create New Field

* Click the **+ Add field** button.

#### 4. Configure Field Details

* In the **Field name** field, enter "Yesterday's Date".
* In the **Field type** dropdown, select **Calculation**.
* In the **Calculation type** dropdown, select **Custom equation**.
* In the **Output type** dropdown, select **Date**.

#### 5. Build Formula

* In the **Formula** field, enter the following formula:

```
{{today's date}} - 1
```

* This formula subtracts one day from the "Today's Date" field to calculate yesterday's date.

#### 6. Test Formula

* Click the **Test** button to validate the formula.
* Verify that the formula returns the correct yesterday's date for different today's dates.

#### 7. Save Field

* Click the **Save** button to create the custom field.

#### 8. Verify Field Update

* Navigate to a contact record.
* Observe that the "Yesterday's Date" field is not yet updated because it depends on the "Today's Date" field.

#### 9. Update "Today's Date" Field

* Update the "Today's Date" field for the contact.

#### 10. Refresh Contact Record

* Refresh the contact record.

#### 11. Observe Updated "Yesterday's Date" Field

* Verify that the "Yesterday's Date" field is now updated to the day before the updated "Today's Date" field.

### Conclusion

By following these steps, you can create a custom field in HubSpot that automatically displays yesterday's date based on the "Today's Date" field. This field can be useful for filtering records, creating automations, and other purposes in HubSpot.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.leanscale.team/crm-tips/hubspot/create-yesterdays-date.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
