Solved

vb.net .aspx date test

Posted on 2009-04-02
2
328 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

724 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