Date / Time Formatting for Analytics

Date / Time Formatting for Analytics

TL;DR - I can't figure out how to format date time info without losing the time portion.



I am attempting to use Flow to Create a Row in Analytics every time a row is created in a Google Sheet.

The trigger works fine.

The action of Creating a Row is a little touchy because of the yellow highlighted date field formatting requirement:


Even though that looks like the format of the system Current Datetime field, the system field does not work with the Flow because of formatting issues.

To rectify this, I am attempting to use a custom function to format the date. My code looks like this:
  1. string formatDate(date myDate, string format)
  2. {
  3. dateStr = myDate.toString(format);
  4. return dateStr;
  5. }

I then insert the custom function into Flow, and populate the variables as shown below:

Unfortunately, this ends up stripping out the time portion of the datetime parameter, as shown below:



It seems like the function isn't recognizing the datetime as a datetime, only a date. Is that a declaration error in the custom function, or is something else going on?