?
Solved

VB.NET - Times based on Daylight Savings

Posted on 2006-11-01
8
Medium Priority
?
372 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 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