Results 1 to 2 of 2

Thread: [RESOLVED] datediff function not working

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2014
    Posts
    23

    Resolved [RESOLVED] datediff function not working

    I have a string called datestring which contains the string "23, 06, 2015"
    I was trying to use the DateDiff and Parseexact function to find the number of days between today see if i could get the program to fetch the number of days between today (the 22nd) and the string, however it always produces -149 and i don't know why. Here's my code:

    Dim tempdate as string = "23, 06, 2015"

    Dim tempdate As Date = Date.ParseExact(teststring, "dd, mm, yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)

    RichTextBox1.Text = DateDiff("d", Date.Today, tempdate)

    the rich textbox should be producing 1 but it always produces -149 and i don't know why

  2. #2
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Re: datediff function not working

    I think the problem is that mm refers to minutes. You want MM instead.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width