Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Time(UTC) difference occurs in application running in local to azure?

In my application we storing the created datetime(In UTC) in database.This works correctly while running the application in the local machine,Same application run from azure nearly +2 min difference occurs from the local executed app.

Same issue occurs between Sql server(on-premise) and Azure Sql

like image 851
Phani Rao Avatar asked Dec 30 '25 08:12

Phani Rao


1 Answers

a "+2 min difference" sounds like it may be due to differences in the system clocks between the two systems.

Your question doesn't specify the source of the " created datetime(in UTC) "

Is that from a database function, or from your application?

The most likely explanation for the behavior you observe is that system clocks on the two different systems are not synchronized using the same time service.


A four-dollar timex watch keeps better time than the hardware clock in a $4000 server. (I'm surprised the drift is only two minutes.) If you want the clocks on the two systems to match, there needs to be a mechanism to keep them synchronized with each other.

FOLLOWUP

I believe the answer above addressed the question you asked.

You may have some additional questions. I think the question you may be looking for an answer to might be... "How do I configure multiple Windows servers so the system clocks are synchronized?"

Some suggestions

  • Windows Time Service (Does Microsoft provide a mechanism?)
  • NTP = Network Time Protocol (Does Azure support NTP?)
  • time.windows.com (What is the default time source on Azure?)
  • once a week - (What is the default frequency ...

etc.

like image 70
spencer7593 Avatar answered Jan 01 '26 05:01

spencer7593



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!