|
-
Mar 6th, 2007, 02:17 PM
#1
Thread Starter
Hyperactive Member
-
Mar 6th, 2007, 02:36 PM
#2
Re: New Daylight Savings Time Problem
Did you apply the Hotfix as DST has been changed to a new starting date.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 6th, 2007, 02:43 PM
#3
Thread Starter
Hyperactive Member
Re: New Daylight Savings Time Problem
Yes I have applied all the latest patches and hotfixes. Win XP Service Pack 2 with all patches. But when I run that code it returns March 4th instead of March 11th like in the image.
-
Mar 7th, 2007, 02:03 AM
#4
Re: New Daylight Savings Time Problem
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 7th, 2007, 08:30 AM
#5
Thread Starter
Hyperactive Member
Re: New Daylight Savings Time Problem
Thanks RobDog888, I had seen that page and the results are still the same. I tried Home User and I tried Software Developer.
However it still doesn't explain why the above code would return March 4th and also for subsequent years as you can see in my posted image. Have you tried the code from vbnet? Does it return also March 4th on your machine?
From the microsoft site for developers concerning DST:
http://msdn2.microsoft.com/en-us/vstudio/bb264729.aspx
After the DST update, versions of Windows prior to Windows Vista will have DST values that are correct for 2007 onwards but historical DST values may not be.
-
Mar 7th, 2007, 01:29 PM
#6
Re: New Daylight Savings Time Problem
If you try
vb Code:
tmp = DateSerial(tziYear, _
.wMonth, _
(.wDayOfWeek - MonthFirstWeekday + _
.wDay * 7) Mod 7 + 1 + (7 * (.wDay - 1)))
in GetTimezoneChangeDate you should get the correct dates. (There must be a way to simplify it, but I'm too tired to think.)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Mar 7th, 2007, 01:37 PM
#7
Thread Starter
Hyperactive Member
Re: New Daylight Savings Time Problem
Thank you very much Al42. Your help is much appreciated. It works now.
Out of curiosity, what is your logic for adding this?
Code:
+ (7 * (.wDay - 1))
-
Mar 7th, 2007, 04:57 PM
#8
Re: [RESOLVED] New Daylight Savings Time Problem
Empirical Engineering. 
The original result was always the first Sunday of the month, regardless of what .wDay was, so we had to add 7 * (the number of weeks - 1).
On further reflection
vb Code:
tmp = DateSerial(tziYear, _
.wMonth, _
(.wDayOfWeek - MonthFirstWeekday + _
.wDay * 7) + 1)
is a much simpler solution - instead of fixing the error, just don't cause it in the first place.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Mar 7th, 2007, 05:46 PM
#9
Thread Starter
Hyperactive Member
Re: [RESOLVED] New Daylight Savings Time Problem
Thanks again Al42.
But would this work for all timezones or just the US timezones?
Should I also add the same code to the second part in Week 5?
Code:
Case 5: 'last week in month
'Calculate the month's last day,
'then work back to the appropriate
'weekday
tmp = DateSerial(tziYear, .wMonth + 1, 0)
tmp = DateAdd("d", tmp, -(Weekday(tmp) - .wDayOfWeek + 7 - 1) Mod 7)
-
Mar 7th, 2007, 06:14 PM
#10
Re: [RESOLVED] New Daylight Savings Time Problem
 Originally Posted by Hassan Basri
But would this work for all timezones or just the US timezones?
It will work to get the first, second, etc., Sunday (or whichever day you want) from the structure it's being fed, but I have no idea whether Windows will give you the correct details about what the change dates are (first Sunday in March, second Tuesday in May, whatever) for other countries.
Should I also add the same code to the second part in Week 5?
That one seems to not only work properly for the 5th week, if the month has 4 weeks you'll get the same date for week 4 and week 5 (which is technically wrong, but conceptually [the concept is "last day", not that day in the 5th week] correct). So don't change it.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Mar 7th, 2007, 06:32 PM
#11
Thread Starter
Hyperactive Member
Re: [RESOLVED] New Daylight Savings Time Problem
Thank you my friend you have really helped me out here.
P.S.
I tried giving you a reputation point but got this message:
You must spread some Reputation around before giving it to Al42 again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|