Welcome to the Airtable Community! If you're new here, check out our Getting Started area to get the most out of your community experience.

Inserting Today's Date and Time Using Script

Topic Labels: Scripting
Jump to Solution
779 1
Showing results for 
Search instead for 
Did you mean: 

Before starting this, I will say I have no background in writing script.  Any script/code I have posted was created using OpenAI API.

What I am trying to create is an automation that upon an update in a selected Single Select Field will begin an automation that utilizes a script to input today's date & time in an adjacent Time/Date field.

When I entered the code below into the Edit Script window and ran a test, the test failed with an error stating "

ReferenceError: document is not defined at main on line 12"
Can anyone provide feedback of what I need to change to make it work?

var today = new Date();

var options = {

  timeZone: 'America/New_York',

  hour: 'numeric',

  minute: 'numeric',

  second: 'numeric',

  hour12: true


var timeString = today.toLocaleString('en-US', options);

var dateString = today.toLocaleDateString('en-US');

var dateTimeString = dateString + ' ' + timeString;

var dateTime = document.createElement('div');

dateTime.innerHTML = dateTimeString;



1 Solution

Accepted Solutions

Found solution with @kuovonne's automation helpers.

See Solution in Thread

1 Reply 1

Found solution with @kuovonne's automation helpers.