Simple Date Issue

  • 10 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.

     

    Thanks

     

  • 10 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
    Wend







Post a reply

Enter your message below

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

Contribute

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.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic