How do I tell Google Apps Script a Date from Google Sheets is in UTC?

47 Views Asked by At

I have a Slack workflow updating a Google Sheet with the timestamp the workflow was run.

Slack outputs timestamps as a UTC String, but there doesn't appear to be a time zone attached to it, so Google thinks it's a local time (Mon, 16 Oct 2023 13:07:42 is what appears in the sheet when the workflow was actually run at 09:07:42).

I need to manipulate that timestamp to show actual local time in EST or EDT. Right now I'm manually subtracting the UTC offset of either 14400000 or 18000000, depending on the current date, but I feel like there has to be a cleaner way of going about this.

How do I tell Google Apps Script that the date it's looking at is actually UTC instead of local time?

1

There are 1 best solutions below

0
Joshua Pelton-Stroud On

While I'd still like to see a Google Apps Script answer, turns out if you just add GMT to the Slack workflow step, Google can suddenly figure it out.