Solved

VB.NET - Times based on Daylight Savings

Posted on 2006-11-01
8
370 Views
Last Modified: 2012-06-27
I have written an VB.NET .ashx page that displays the time for Melbourne (VIC), Irvine (California), and Toronto (Canada), but I need to take into account the daylight savings time periods for those cities and adjust the time accordingly, but can't get my head around the code that is needed.

Does anyone have any suggestions on how I should do this?

I'm using the command "DateTime.UtcNow" to get the GMT time.

Thanks!
0
Comment
Question by:CDFx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:CDFx
ID: 17856378
Thanks Ramuncikas, but I don't think they'll help me in this situation.
0
 
LVL 15

Expert Comment

by:OMC2000
ID: 17856435
The only problem here is that Daylight Savings Time starts and stops at different dates.

check answer based on the database table at
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_20103151.htm

or just use general approach, add subtract difference in hours from your time.
Change number of hours depending on current date.
Make functions:
f1, which calculates difference between your time and GMT, you will always get correct difference for your time zone based on OS functionality.
f2, which calculates difference between desired time zone and GMT,
it must take daylignt saving into consideration. If current date is within daylight savings period, function returns 2, otherwise 1.

sum of the results of these two functions is number of hours, which you should subtract from you current time.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 15

Expert Comment

by:OMC2000
ID: 17872435
It becomes popular to declare that "I solved problem by myself", after the answer, which describes the working solution, was posted.

Well, close it and refund. It's just a reason to check questioner's history first.
0
 

Author Comment

by:CDFx
ID: 17872568
Your so-called "working solution" had nothing to do with me solving the problem.  I actually found the solution myself using some code from this site: http://www.michaelbrumm.com/simpletimezone.html
0
 
LVL 15

Expert Comment

by:OMC2000
ID: 17879221
Ok, fine, "close it and refund" points.
0
 
LVL 1

Accepted Solution

by:
kodiakbear earned 0 total points
ID: 17894469
Closed, 500 points refunded.
kb
Experts Exchange Moderator
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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