Q:

Submission timestamp of custom Form using Google Apps Script

I wanted to create a form for data collection that included a field for image upload. I tried Google Forms, which natively doesn't support file upload, but I found this example: Form and file upload with htmlService and app script not working
I managed to configure it with image upload, BUT, native Google Forms does have a timestamp column on the Spreadsheet responses. 
I tried:
var timestamp = theForm.getTimestamp();
But didn't work...
How can I get the response timestamp?
Code excerpt:
function processForm(theForm) {
  var fileBlob = theForm.myFile;
  var folder = DriveApp.getFolderById(folderId);
  var doc = folder.createFile(fileBlob);

  // Fill in response template
  var template = HtmlService.createTemplateFromFile('Thanks.html');

  var name = template.name = theForm.name;
  var email = template.email = theForm.email;
  var timestamp = template.timestamp = theForm.getTimestamp();

  // Record submission in spreadsheet
  var sheet = SpreadsheetApp.openById(submissionSSKey).getSheets()[0];
  var lastRow = sheet.getLastRow();
  var targetRange = sheet.getRange(lastRow+1, 1, 1, 5).setValues([[timestamp,name,department,message,email,fileUrl]]);

  // Return HTML text for display in page.
  return template.evaluate().getContent();
}

A:

HTML forms do not automatically pass any timestamp to the server on submit, like Google Forms do. You will have to generate that timestamp yourself. new Date() will do what you want:
var timestamp = template.timestamp = new Date();

If you need to output this date object to screen in your page, you will need to make it human-readable by formatting it. You can use Utilities.formatDate() method to do this.

