Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I'm working with an Online E-Commerce Web site and currently looking to do an analysis of how the time difference between two different time zones would affect our Web Application.

This is what is the current Scenario I'm working with.

"Our Servers are currently located in Washington now and they are planned to be moved to Chicago in next few months. They belong to two different time zones and I have to do the analysis of the difference aspects that would need to be taken care with respect to Code (C#) and as well as the other configuration stuffs"

My first take is to search the code and find out what are all the web pages/fields that uses the DateTime type in C#.

I'm not sure what to do next in this regard.

Can you please guide me as to what are all the aspects that to be addressed with respect to this scenario?

Your help is highly appreciated and Thanks in Advance for your help.

Thanks,
Bryan.
Posted
Comments
tumbledDown2earth 17-Jun-13 2:16am    
What is the timezone of your database? Is it the same as server? how do you insert time in the database (server specific / database specific) ?
Balaji K Bryan 17-Jun-13 2:28am    
AFAIK, The Web Server and the DB Server are currently located under the same time zone and also they both would be moved to new Chicago TimeZone. We insert the time through C# code and hence I believe the date times are inserted from the time of the Web Server.

Should you need any further info, please let me know.
Sergey Alexandrovich Kryukov 17-Jun-13 2:39am    
It does not matter; please see my answer.
—SA
tumbledDown2earth 17-Jun-13 2:32am    
When your server moves, the first thing would be to set existing datatime values in the database to the new timezone.
Balaji K Bryan 17-Jun-13 2:42am    
Okay, thanks. Is there a database function that would help me doing that? Apart from updating the date time values in database to new date time zone, is there anything with respect to C# code, that I need to take care of?

An Article from MSDN, Converting Times Between Time Zones (http://msdn.microsoft.com/en-us/library/bb397769.aspx)talks about making code changes to adjust with the new time zone. Is this relevant in my scenario?

Please advice.

1 solution

I think the best approach is to always work in Coordinated Universal Time: http://en.wikipedia.org/wiki/UTC[^].

This way, any concerns of the server-side time will be eliminated, so, for example, you can freely relocate any of your servers having no problem with this part of functionality. The local time should appear only on client sides, not matter where they are. Please see:
http://msdn.microsoft.com/en-us/library/system.datetime.utcnow.aspx[^],
http://msdn.microsoft.com/en-us/library/system.datetime.tolocaltime.aspx[^].

—SA
 
Share this answer
 
v2
Comments
tumbledDown2earth 17-Jun-13 3:06am    
Agreed ... However, I see most legacy or semi legacy applications dont use this idea ... Makes me ponder of the near history of SW development (may be moving a server was never foreseen) :) --my5
Sergey Alexandrovich Kryukov 17-Jun-13 10:55am    
OK, but we are not talking about legacy applications. Those "legacy applications" have tons of stupidities, so why even discussing them?
Not only moving the server was foreseen, but even the advent of times beyond 2000 wasn't. :-)

Thank you.
—SA
tumbledDown2earth 18-Jun-13 0:06am    
why doesn't cp have a tweet button? I would have re-tweeted this :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900