Greetings,

Guys could you give me some idea on how to count months left before the due date?

For example

08/17/2012 - 12/17/2012

result: 4

Private Function GetMonths(ByVal dtFrom As DateTime, ByVal dtTo As DateTime) As Integer

        Dim dtDiff As TimeSpan
        Dim nTotalMonths As Integer

        dtDiff = dtTo - dtFrom
        nTotalMonths = dtDiff.TotalDays / 30 ' We take 30 for a month

        GetMonths = nTotalMonths

End Function

Hope this helps

Sir, can this code could also be used in datetimepicker?

Ao.No.Enjeru

Its possible. Every datetimepicker's Value attribute is a variable of type DateTime.

So simply call

GetMonths(dateTimePicker1.Value, dateTimePicker2.Value)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.