Skip to main content
Solved

Automation: Create new record with today's date


  • New Participant
  • 2 replies

Hi, I need some help in creating an automation. My goal is when I create a new record in my Projects tab, it automatically adds today's date in the "Date Created" column. I've been looking into using an update record automation or a TODAY() formula, but I can't seem to get it to work. Any help appreciated!

Best answer by Ron_Daniel

If you make a new column called "Date Created", all you need to do is make it a formula, which is simply

CREATED_TIME()

If you want to format the date, just encapsulate that in Datetime Format. For example, if you wanted it to say 01/10/2023, you'd use
DATETIME_FORMAT(CREATED_TIME(),'MM-DD-YYYY')

Here is a list of all the format specifiers:
https://support.airtable.com/docs/supported-format-specifiers-for-datetime-format
 
View original
Did this topic help you find an answer to your question?

4 replies

Karlstens
  • Inspiring
  • 601 replies
  • January 10, 2023

Time and dates can be a little tricky at first - it took me awhile to figure out the correct Javascript Time/Date syntax, mixed in with how Airtable expects and interprets dates be it in Scripting App Extension or an Automation Script.

Firstly, get to know Date objects in Javascript. I run a free app called VS Code, and also a JavaScript Plugin called Quokka that gives me instant results from my Javascript as I type. This morning, I wrote this table to help me figure out why one of my dates in Airtable was screwing up. It became an exercise in "What does time look like" 😂 as I tabulated the results.

But from understanding how this JavaScript works, I can now take these methods into an Airtable Automation and hopefully push the correct data into Date fields.

Regarding Airtable Date fields, there's a couple of catches.

If your Date field is showing without time, then Airtable will show GMT time at 00:00. I often have to *think* when dealing with this simple Date column, as I typically need it to show a date that's 11 hours ahead, so typically I'm putting in tomorrows GMT date into a Date only field thanks to my local timezone.

If your Date field is showing both Date and Time, then Airtable will be time specific and a little easier to work with, as you can feed it the GMT date/time but then show it in your local time via the Field options.

Also, a side note, you shouldn't need to worry about using a formula field with dates - there may be exceptions where it might make life easier/or act as a workaround, but typically I write all my date formatting code in the script and not in an accompanying formula field.

Regarding your Automation idea, this is a great project and hopefully you'll learn lots.

 


Ron_Daniel
  • Inspiring
  • 104 replies
  • Answer
  • January 10, 2023

If you make a new column called "Date Created", all you need to do is make it a formula, which is simply

CREATED_TIME()

If you want to format the date, just encapsulate that in Datetime Format. For example, if you wanted it to say 01/10/2023, you'd use
DATETIME_FORMAT(CREATED_TIME(),'MM-DD-YYYY')

Here is a list of all the format specifiers:
https://support.airtable.com/docs/supported-format-specifiers-for-datetime-format
 

  • New Participant
  • 1 reply
  • January 10, 2023

RonDaniel's solution should work too, but you can also set up a trigger so whenever a form is submitted, it updates the record in the Date Created column to be TODAY(). 


  • Author
  • New Participant
  • 2 replies
  • January 10, 2023

Thank you—these are all helpful! @Ron_Daniel I used your solution and it worked well! I hope eventually they add the option in an automation to change the record to the date created, instead of picking a specific date. 


Reply