AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed Rizwan Muhammad Rizvi
Expertise
I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.

Experience
Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > find a date

Topic: VB.NET



Expert: Syed Rizwan Muhammad Rizvi
Date: 2/4/2008
Subject: find a date

Question
Hi Scott,

Using Microsoft Access VBA this is what I need to determine: On ODD Number years(2005,2007), the Webnesday folling the first Monday in January.
On Even Number years(2006, 2008), The Wednesday following the first Monday in Febuary and the Wednesday following the first monday in May

Answer
here is the pseudo code:

Dim intYear as Integer = Year(Date)

if inYear Mod 2 = 0 then
'Even Year
Dim blnFoundFirstMonday,blnFoundFirstWednesday as Boolean
blnFoundFirstMonday=False
blnFoundFirstWednesday=False
For I as Integer = 1 to 15
Dim dt as Date = DateSerial(intYear,1,I)
If WeekDay(dt)= 2 Then
'1 = vbSunday - Sunday (default)
'2 = vbMonday - Monday
'3 = vbTuesday - Tuesday
'4 = vbWednesday - Wednesday
'5 = vbThursday - Thursday
'6 = vbFriday - Friday
'7 = vbSaturday - Saturday
blnFoundFirstMonday = True
Exit For
End If
If blnFoundFirstMonday Then
If WeekDay(dt)= 4 Then
blnFoundFirstWednesday = True
Exit For
End If
End If
Next
Else
'Odd Year
'Repeate same code like above to find for odd numbers
End If

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.