find current time using country name and timezone in csharp
Hi,
I am using C#. I have one task that is i have two parameters
1. country name
2. Timezone of country
Now i needed that using these two parameters i need to get current local time of the country. That is i buy one package. Users can be anywhere to buy my package. I can get country name while registration and get timezone. Now i need to insert the current time of user buying my package. How can i find in csharp?? Is it possible??? If yes, i am waiting for yours reply.
Thanks
Re: find current time using country name and timezone in csharp
Hey,
The DateTime Structure:
http://msdn.microsoft.com/en-us/libr....datetime.aspx
Has a number of methods available that make this kind of operation very easy. For instance:
http://msdn.microsoft.com/en-us/libr...localtime.aspx
You can get the Local Time zone from the browser sending the request, and from there you can work out the time where the server is.
Hope that helps!!
Gary
Re: find current time using country name and timezone in csharp
If you are using .Net 3.5 they came up with a pretty versatile class called TimeZoneInfo and you may want to use that.