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

Currently i'm taking Server time as default in an application. Now if i launch the application in any other country, by specifying the country name, i want to send back that particular country's GMT time , instead of server moment country's time.

Kindly anybody give the code.




Regards,
R.Santhya

I have already tried, that i can able to take the server time and current country GMT time by using the zone time, as well as i have tried that, i can able get Central European Time, and Eastern European Time. If i want to try for particular country name by as zoneid , i cant to do so.

string zoneId = "Central European Standard Time";
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
Posted
Updated 26-Apr-11 19:53pm
v2

Kindly anybody give the code.
Avoid this please! We expect you to try, make some effort and then post where you get stuck. Asking for code would not help anyone! :doh:

i want to send back that particular country's GMT time , instead of server moment country's time.
It's a Web application. People from any country would be connecting to a webserver sitting somewhere else. if you want particular time GMT, you have to trace the country and make changes to the response while returning the time. Or use some ActiveX/JavaScript to get the time from the client system and use it. It would entirely depend on type of scenario/requirement you have. Generally, it's picked from client machine and displayed. Server does not do anything.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 27-Apr-11 0:57am    
You are right. My 5.
And I referenced my recent answer which should help to understand what's involved, please see.
--SA
Hope my recent answer to a similar Question will help you to understand all this:
[Solved] XML Date Time Conversion Issue[^].

[EDIT]

My other recent answers shows how to list the time zones:
GMT Time using particular country name[^].

You can generate a list of zones at the server, present it to the user and ask the user to create an account and select one of the time zones. Make it mandatory by server-side validation, don't allow for default zone. In this way, you will be able to do time calculations depending on the account's time zone data.

—SA
 
Share this answer
 
v3
Comments
Sandeep Mewara 27-Apr-11 1:00am    
5! :)
It would make him more clear now on what I was talking of. Zones are the things on which it would be dependent. And client machine his best bet to get time time on every system for a web-app.
Sergey Alexandrovich Kryukov 27-Apr-11 1:26am    
Thank you, Sandeep.
I was just thinking if a time zone info could be sent to server during each authentication, automatically (without asking a user for explicit specification of it during account registration; for example, CodeProjects asks for the zip code for future geolocation, which is not applicable to all countries).

Is it possible, how do you think?
--SA
Sandeep Mewara 27-Apr-11 1:31am    
If user does not provide his timezone/county info or the app does not extracts the time from client system(using ActiveX), it would be difficult to give client/user system based timing.

Issue/hurdle is to find the client system timezone and pass it on to server.

What do you say. Sounds right?
Sergey Alexandrovich Kryukov 27-Apr-11 3:22am    
Sound right, thank you. I simply don't know such way at the moment and not sure such way can be portable.
--SA
Sergey Alexandrovich Kryukov 27-Apr-11 3:32am    
See also my update about the time zone (after [EDIT]) and my comment about UCT.
Does it make sense?
--SA

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