Help

"Send an Email" Automation - remove the timezone code from "actual trigger time"

Topic Labels: Automations
72 3
cancel
Showing results for 
Search instead for 
Did you mean: 

Hello,

I’m building an Automation in Airtable and am using the “at a scheduled time” trigger and the “send an email” action.

In the “send an email” action, in the email subject line, I’d like to include the “actual trigger time”.
However, the time includes the date and timezone code, and I’d like to remove the timezone code.

As an example, here’s what I want the email subject line to say:

“Weekly Sales Report - 2022-11-08”.

But instead it looks like this: “Weekly Sales Report - 2022-11-08T22:51:31.571Z”. Is it possible to strip out the timezone code (T22:51:31.571Z)? Or can someone suggest an alternative solution?

Thanks so much!

3 Replies 3

Hey there Paul!

There are a few ways you can do this, my personal preference is to use a Script action in the automation because it’s the simplest to integrate and you don’t have to worry about relying on fields etc.

Here are the steps to achieve what you’re looking for:

  1. Add Action
  2. Run Script
  3. A new script window will appear, paste the code below into the main window overwriting what is in there.
let today = new Date();
const [currentDate] = today.toISOString().split('T');

output.set('todaysdate',currentDate);
  1. Now in your email subject line just add the value from the script in the automation which will be called todaysDate.

Hopefully that works for you!

Kyle

@Paul_Matsushima Unfortunately, Airtable’s Automations always use that timezone code.

The non-scripting way of working around this is to create a formula field in your base (using the DATETIME_FORMAT function) to create a text string.

Then, you can insert that formula field into the subject of your email.

It’s kind of a pain because it creates extra clutter in your base, but it will do the trick.

Thanks @KVachon. I tried the script and it ran perfectly! That did the job for me.

And thanks @ScottWorld for the advice. Yeah, I was trying to avoid adding a new field in my base as I didn’t want to clutter it up.