Solved

VB.NET - Times based on Daylight Savings

Posted on 2006-11-01
8
359 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
8 Comments
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17856331
0
 

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now