Solved

vb.net .aspx date test

Posted on 2009-04-02
2
290 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
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…

929 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

15 Experts available now in Live!

Get 1:1 Help Now