Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I wanna know about social networking sites timing maintenance.It's server is at fixed position then how will it get the exact timing at different location or country.

For example:

I have posted something at (9:30 AM) on social networking sites then it shows the exact time(9:30 AM) of post or it shows exact your system time.

please explain the query to show exact timing of system everywhere.Timing will be independent from server location.
Posted
Updated 25-May-15 23:30pm
v3

1 solution

Well...it's isn't independant of the server time. And yet...it is, sort of.

What you do is store all values in the server relative to a specific time zone (which can be the time zone the server normally lives in but that can be a bad idea) - and the best zone to pick is UCT: Universal Coordinated Time[^] which isn't a time zone at all! :laugh:

UTC is referenced to a single geographic line of longitude and is never affected by "summer time" or "winter time", and is the base for all world time zones. If you store your values in UTC, then you can convert them on the fly to the local time for the correct user anywhere in the world - and the local time will take care of plus or minus x hours, summer time, and so forth. So what your user ends up with is the time specific to their current location, regardless of where in the world they log in from.
 
Share this answer
 
Comments
[no name] 26-May-15 6:45am    
would you know the format of the uct
barneyman 26-May-15 7:08am    
it doesn't have a format - it's just time ... what makes it UTC is that it has no timezone (technically, it has TZ0), or DST applied .. it can be expressed (according to ISO8601) as a time string with Z at the end
itsathere 26-May-15 7:28am    
how will i insert UTC time into sql and after insertion how will i get the actual time in different time zone.

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