Simple Date Issue

  • 11 years ago

    Hi All,
    I have a very simple issue and am hoping someone can help.
    I retrieve two dates from a database into 2 Date variables. What I wish to do is find the dates between them.

    i.e Given 27/11/2006 and 01/12/06

    I would get the values 28/11/06, 29/11/06 and 30/11/06
    Im sure this is really simple, but I cant get my head round it at all.




  • 11 years ago

    Theres probably a really slick way of doing this but the following may work:

    Dim date1, date2 As Date
    date1 = "27/11/2006"
    date2 = "01/12/2006"
    While DateDiff(DateInterval.Day, date1, date2) > 1
    date1 = DateAdd(DateInterval.Day, 1, date1)
    TextBox1.Text = TextBox1.Text & date1 & vbCrLf

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond