Code is working fine , I have checked it. But when using in Power Automate cloud flow - Date formats returned by data sources like sharepoint, excel etc would be in UTC format, also datetime returned by power automate expressions unless you are converting the UTC to your local timezone. So for example - you are using utcNow() to get current date and time , but it returns current date and time in UTC format which may be different from your timezone (may be some hours backwards which causes date to appear previous day) which would cause calculation wrong.
So to resolve that - use convertFromUtc function which helps to convert the time from UTC to other timezone such as your local timezone- before you pass the datetime value to custom code connector.
Was this answer helpful?
If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
Your feedback motivates me to keep contributing. Thank you!
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.