Table of Contents

How to Display Multiple Date Formats Using a Single Date Field

Danielle Kellogg Updated by Danielle Kellogg

Scenario

You want to display a date field in different formats.

For example, let’s say that you’re accepting registrations for an event and want to show the date of the event in the following formats:

On the event’s information page for international attendees

21/7/2018 at 7pm

On the reminder email for the event

Saturday, July 21 at 7:00pm

On the receipt for the event

07-21-2018

Requirements

If this your first time creating an app, you'll need to know some basics about adding objects, fields, pages, and views. You can start by reading our Builder Basics section

Other good resources can be found in our designing the database and building pages sections of the knowledge base.

This date formatter is available in text formulas. Click here for information on text formulas.

Steps

Create a Date/Time Field

If you don’t have one already, create a date/time field in the Events object.

In this example, we use the date/time field “Event Date”:

Format Date for International Attendees

Now that you have a date field, you can start creating the different date formats you’ll need.

First up is the date format you want to use on the event’s information page for international attendees: 21/7/2018 at 7pm.

  1. Create a text formula and call it “International Date Format.”
  2. Use the following formula:
  • formatDate({Event Date}, D/M/YYYY [at] ha)

This is how it will look in the Builder:

This is how it will look in the Live app:

image1.png

Format Date for Reminder Emails

Next is the date format you want to use on the reminder email for the event:

Saturday, July 21 at 7:00pm.

  1. Create a text formula and call it “Reminder Email Date Format.”
  2. Use the following formula:
  • formatDate({Event Date}, dddd, MMMM D [at] h:mmA)

This is how it will look in the Builder:

This is how it will look in the email:

image4.png

Format Date for Receipt

Last is the date format you want to use on the receipt for the event: 07-21-2018.

  1. Create a text formula and call it “Receipt Date Format.”
  2. Use the following formula:
  • formatDate({Event Date}, MM-DD-YYYY)

This is how it will look in the Builder:

This is how it will look in the Live app:

image6.png

More Date Formats

The formats included in this article only cover a few of the date formats you can create.

To create other formats, take a look at the other date formatter output options in this article: Date Formatter.

Notes & Troubleshooting

Populate a text formula with values

Once your text formula is created, the values in this field will automatically populate.

Depending on the number of records in that object, it may take just a bit of time. If you don't see the values populate immediately, give it a few minutes and come back to that object's records. Do contact Knack support if these field values continue to stay blank.

Scenarios where text formulas can’t be used

There are a few situations where text formulas can’t be used:

  • Not available on forms
  • Can’t reference fields with a "many" connection (since there are many values connected and text formulas can only pull in a single value)
  • A connection field in another object

How did we do?

How to Extract the Start and End Dates from a Date Field

Contact