How to fix the timezone problem for the Date filter for "Today" ?

Pegi Cheng (CSD) 1 Reputation point
2022-09-16T09:43:00.497+00:00

Hi all,

I've built a proof of concept which filters a table of data using office scripts and returns an image of the table of data that has been filtered. I am using the Today expression to apply a dynamic filter. Im locate in Hong kong and i noticed by accident that if I run the script from Power Automate prior to 8am, it will return yesterday's data but if I run it from Office Scripts, it will return today's. Therefore it looks like the Script is running UTC +8 via Power Automate but honours my locale from the Office Script when run from Excel.

Please advise how to fix the issue above.

Thanks!! Cheers!!

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,914 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yutao Huang - MSFT 701 Reputation points Microsoft Employee
    2022-10-06T16:25:20.563+00:00

    @Pegi Cheng (CSD) ,

    Please see if my answer to this similar question on the Power Automate community would help: https://powerusers.microsoft.com/t5/Using-Connectors/Excel-Office-Script-Timezone-vs-Power-Automate-Timezone/td-p/947420

    Time zones are tricky in Excel and Office Scripts, especially when you are running the script with Power Automate. The gist of the solution is to "pin" to a specific time zone.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.