Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi all
 
i wrote the below code to find the date difference
 
Dim var As String
        var = ds.Tables(0).Rows(0)(0)
        connection.Close()
        Dim time As DateTime = var
        Dim mth As Integer
        mth = DateDiff(DateInterval.Month, DateTime.Now, time)
        If mth <= 6 Then
but i am getting the "mth" value in negative..please tell me where i am wrong
 
the value of "time" is 1/8/2012
Posted 25-Sep-12 20:31pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try switching the parameters :
mth = DateDiff(DateInterval.Month,  time, DateTime.Now)
  Permalink  
Comments
snehasish nandy at 26-Sep-12 1:43am
   
Got it..thanks..need one more help..how to refresh a grid according to date..??means only day wish data it should show.it shouldn't show previous days entries..
snehasish nandy at 26-Sep-12 1:48am
   
please reply..i need help in this..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 PIEBALDconsult 110
3 Richard MacCutchan 105
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100