Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Access: Daylight Savings Time
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   18 years ago

Q: I have a table that imports data that has a date and time stamp in Arizona. The time needs to be converted into the Central Time Zone. So, for half of the year, I need to add 2 hours and the other half of the year I need to add one hour. Is there a way to create a query where it knows how many hours to add based on daylight savings? I'd prefer the query to be in VBA. - Art


A: Good question.

Well, you'd need to know what dates you're working with for your calculations. A quick Google search tells me that DST goes into effect in 2008 on March 9, and ends on November 2. Knowing this, we can just create a CALCUALTED QUERY with the IIF function to add the hours when appropriate.

Assuming only dates in 2008, and that the date stored in your table is called MyDateTime, then our new field would be:

NewDateTime: IIF(MyDateTime >= #3/9/2008# AND MyDateTime <= #11/2/2008#, MyDateTime + (1/24), MyDateTime)

In English, this basically says if MyDateTime is between 3/9/08 and 11/2/08 then set NewDateTime equal to MyDateTime plus one hour (1/24 of a day), otherwise, leave it alone.

Now if you need to adjust for time zones, add another hour where appropriate.

Also, this of course only takes into consideration calculations FROM ONE YEAR (2008). If you need to calculate different years, you'll need to get a list of all the DST dates. I would probably load them all into a table and then perform DLOOKUPS to determine the start and end dates for each year.

Now you're getting complicated, and that's WAY more time than I could take to answer your question here. Perhaps it would make a good tutorial, though.

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Access: Daylight Savings Time
Get notifications when this page is updated
 
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/2/2026 8:39:37 AM. PLT: 0s
Keywords: access daylight savings time tips  PermaLink  Access: Daylight Savings Time