How to create a dynamic book mark? This post will go over how to create a bookmark that will resolve to the current date in the URL path.
Create a new bookmark and enter in the code below into the URL field of the bookmark.
javascript:function url() { var date = new Date(); var y = date.getFullYear(); var m = date.getMonth() +1; if(m < 10){m = '0' + m;} var d = date.getDate(); if(d < 10){d = '0' + d;} var date = String(y) + String(m) + String(d); return 'https://docs.google.com/a//forms/d/e/1F874njiAvg/viewform?entry.528742098=' + date + '&entry.5485865554=Start'; } window.open(url(),"_blank");
With this example the Google Form has two inputs, a date(string) and start(string).
So in order to automate the date string part. It is expecting a YYYYMMDD formatted string. This is achieved in JavaScript by
var date = new Date();
var y = date.getFullYear();
var m = date.getMonth() +1; if(m < 10){m = ‘0’ + m;}
var d = date.getDate(); if(d < 10){d = ‘0’ + d;}
var date = String(y) + String(m) + String(d);