Solved

Figuring out website user's timezone based on UTC offset

Posted on 2012-03-23
1
503 Views
Last Modified: 2012-03-23
I am using ipinfodb.com to detect a website visitor's IP address and figure out their city and timezone. For instance, I can detect city = "ATLANTA" and timezone = "-05:00"

How to I figure out the exact date/time where they are -- I understand I can get UTC time by doing DateTime.UtcNow -- but how do I apply the "-05:00" to UTC to adjust the resulting date/time?

I've done Google searches but all I have come up with is using TimeZoneInfo.FindSystemTimeZoneById -- but this requires a string value of a location, which I don't have. I have the numerical offset hours instead.
0
Comment
Question by:mandi224
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 37758174
Do you mean something like this?

    DateTime.UtcNow.AddHours(-5)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question