date statement in vb6 by month and day only. Not year

Every year, I need to process certain code before April 8 and after January1.  How can I do that using the code below?

SelectMonth = Format(currentServerTime, "mmmm")
            SelectDay = Format(currentServerTime, "dd")
            
            
            If (SelectMonth < "April" And SelectMonth < 9) And (SelectMonth < "January" And SelectMonth > 1) Then
            'add code here
            End If

Open in new window

al4629740Asked:
Who is Participating?
 
Martin LissOlder than dirtCommented:
If (SelectMonth < "April" And SelectDay < "09") And (SelectMonth < "January" And SelectDay> "01") Then
0
 
Martin LissOlder than dirtCommented:
If you want to do it before April 8 (in other words not "on or before" April 8) then change the "09" to "08".
0
 
al4629740Author Commented:
This isn't working

esql = "select GetDate()"
                rec.Open (esql), conn, adOpenStatic, adLockReadOnly
                currentServerTime = rec.Fields(0)
                rec.Close
                    
            SelectMonth = Format(currentServerTime, "mmmm")
            SelectDay = Format(currentServerTime, "dd")
            
            
            If (SelectMonth < "April" And SelectDay < "09") And (SelectMonth > "January" And SelectDay > "01") Then
            Combo1.AddItem "January,February,March"
            End If

Open in new window

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
al4629740Author Commented:
This doesn't seem to work either

If currentServerTime < "04/09/14" And currentServerTime > "01/01/14" Then
            Combo1.AddItem "January,February,March"
            End If

What am I doing wrong?
0
 
al4629740Author Commented:
Ah.  It was a formatting issue.

Thanks
0
 
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.