function formatDateAsRFC3339(date) {
  return Utilities.formatDate(date, 'UTC', 'yyyy-MM-dd\'T\'HH:mm:ssZ');
}
Returns an RFC3339 formated date String corresponding to the given
Date object.
@param {Date} date a Date.
@return {string} a formatted date string.