Solved

vb.net .aspx date test

Posted on 2009-04-02
2
281 Views
Last Modified: 2013-11-26
I am trying t figure out what the code is to test for dates.

Basically, I am trying to populate three labels with text which is triggered on load and by two dates, so something like

if today() is greater than or equal to 3\23 and less than or equal to 10\1 then
label1.text = "have a nice summer" else if..

etc etc, I want to do this about five times covering the whole year, each and every year.
0
Comment
Question by:Zoooink
2 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 250 total points
ID: 24057194
You can use the code below (just create a datetime for the dates you want to compare - I used the System.DateTime.Now.Year to always use the year of the current date)
        If System.DateTime.Now > New DateTime(System.DateTime.Now.Year, 3, 23) And _

           System.DateTime.Now < New DateTime(System.DateTime.Now.Year, 10, 1) Then

            MessageBox.Show("Have a nice summer")

        Else

            MessageBox.Show("Have a nice winter")

        End If

Open in new window

0
 
LVL 3

Author Closing Comment

by:Zoooink
ID: 31566057
Thank you for the solution, you've put me on the right track to complete my problem!
0

Featured Post

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!

Join & Write a Comment

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

744 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