If I have two servers (application and database) with different time zones, which one is better to use as a base?

3

I am working with the MySQL server of a hosting, I can not change the time zone of the same, ie it uses the "Mountain Standard time (MST)", on the other hand, I am using the ASP.NET server and in it I can set the time zone for "Brasilia Timetable (BRST)", the difference is that the MST has -5 hours and whenever I compare something using DateTime.Now in ASP.NET I have problems. >

What is the most usual to work by default?

    
asked by anonymous 10.01.2018 / 18:49

1 answer

3

Schedules should always be stored and handled as UTC, so no problem will occur. You only deal with local time on data entry and exit, always making the entry convert to UTC and UTC to be converted to the desired local time in that context.

No matter what your infrastructure is, this is the only correct way, unless what you need is a fixed time marker, where the time itself (a point on the timeline) does not matter; which was showing on a specific clock or is an abstract time indicator, which might even be just text.

Wrong forms should only be used when there is a data legacy that requires this and can not be conformed to a new default (there are several time places, but it is not known which one is hourly, or code that deals in the wrong way They will both be nightmares.

If so, data does not have much to do without assuming wrong things, if it is code the solution depends on each problem.

    
10.01.2018 / 19:06