Integrate time stamp into form (as hidden element)

Hey guys,

I want to pass a time stap as hidden element when a form is submitted.

The time stamp should look like that: YYMMDD

That shouldn’t be too hard, right ;)? Unfortunately I wasn’t able to get it right so far … :smiley:

Can anyone help me?

Thanks a lot in advance!


1 Like

One way is to use Zapier to handle the form. It automatically adds submittedAt: to the form data.

Hi @orgreeno,

thanks for the fast answer.

Is it possible to show the time stamp it the mentioned format YYMMDD using zapier?

As far as I remember it looked different …

Zapier generates: submittedAt: 2017-12-03T21:22:27.988Z

Here’s an example of one of my submissions:
submittedAt: 2017-11-30T15:20:17.750Z

Using the built-in “Format” action, you can get this - YYYY-MM-DD (2006-01-22) You may be able to customize even more, but I’m not sure.

I am quite sure it shouldn’t be too hard to get YYMMDD with a bit of JS … but I couldn’t figure out how so far …

I might have found a solution :smiley:

I use the following JS in the body:

var today = new Date();
var dd = (today.getDate()).toString();
var mm = (today.getMonth()+1).toString(); 
var yy = (today.getFullYear()-2000).toString();
today = yy+mm+dd;

document.getElementById('timeStamp').value= today ; 

And in the form:

<input type="hidden" name="timeStampID" id='timeStamp' />

1 Like

This will give you the user’s local time (as set on the computer).

Can I configure zappier to EST?

Hey @michael, great script. I need just that. I am trying to implement it but can’t seem to get it working. I am missing something?

Thanks for the help.

2020-05-12_13h59_42 2020-05-12_13h59_50 2020-05-12_14h00_10

Ok, I managed to do it. Here’s how…

Added this to Footer Code in Project Settings:

	var dt = new Date();
	var time = dt.getTime();
    $( document ).ready(function() {
        // after the page elements are all loaded, then run the script


And then changed the ID of my regular input form field. Like so: