Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vb.net .aspx date test

Posted on 2009-04-02
2
Medium Priority
?
347 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 750 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 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