Share via

SQL Server Insert Date is off in workflow

Christopher Fryett 195 Reputation points
2025-09-08T17:20:28.47+00:00

I ran a set of performance tests on a flow which does an insert into a database and I am seeing odd results in the datetime fields. In some records it is an hour off, ie.. showing 9am when it is 10am. Is there an issue around using utcNow() in the flows for sql server shared connector? The on-premises db resides in mountain time while the resource is in US West.

User's image

Azure Logic Apps
Azure Logic Apps

An Azure service that automates the access and use of data across clouds without writing code.


Answer accepted by question author

Rakesh Mishra 9,670 Reputation points Microsoft External Staff Moderator
2025-09-19T07:10:49.26+00:00

Thanks @Christopher Fryett and apologies for delay in response.

From what you said: the flow is sending utcNow() and the insert uses the SQL Server Insert row (V2) connector to an on-prem DB via the on-prem gateway. Most likely the flow is inserting a UTC timestamp into a timezone-naïve SQL column (e.g. datetime/datetime2), so the row appears “off” when viewed in Mountain Time.

Please check

(a) the Logic App run history to see the exact value sent in the Insert action,

(b) the SQL column type (INFORMATION_SCHEMA.COLUMNS) and

(c) the server time (SELECT SYSDATETIMEOFFSET()).

To fix quickly, either convert UTC --> Mountain before insert with formatDateTime(convertTimeZone(utcNow(),'UTC','Mountain Standard Time'),'o') and store in DATETIMEOFFSET(7), or continue storing UTC and convert in your read/presentation layer.

Official docs: Logic Apps expressions, Convert time zone, SQL connector, and datetimeoffset.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

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