Results 1 to 3 of 3

Thread: find current time using country name and timezone in csharp

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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
    Failing to plan is Planning to fail

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  3. #3
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width