Streaming live at 10am (PST)

Integrate time stamp into form (as hidden element)


#1

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!

Michael


#2

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


#3

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


#4

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.


#5

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 …


#6

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();
if(dd<10) 
{
    dd='0'+dd;
} 
if(mm<10) 
{
    mm='0'+mm;
} 
today = yy+mm+dd;


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

And in the form:

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


#7

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