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
Solved

vb.net .aspx date test

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery tab header text 1 23
IEnumerable<T> to a List<T> 8 37
Need syntax help building hyperlink 2 24
PowerShell:  Column widths won't expand 3 17
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

840 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