How do i compare the months from database where my database records are stored in date format (12/12/2013)
Ignoring the days.
For example

This Month 12/08/2013
Next Month 12/09/2013

if both are match, i will return my true else false?

        protected void renewCurrentBudget()
            Boolean renew = true;
            DateTime nextMonth;

            SqlConnection conNew = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
            SqlCommand cmdNew = new SqlCommand("UPDATE Member SET CurrentBudget=@current WHERE Username=@username", conNew);
            SqlCommand cmdToday = new SqlCommand("SELECT NextMonth FROM MonthlyBudget WHERE (Username=@username AND ThisMonth=@previousMonth)", conNew);
            cmdNew.Parameters.AddWithValue("@current", getMonthlyBudget());
            cmdNew.Parameters.AddWithValue("@username", Master.getUsername);
            cmdToday.Parameters.AddWithValue("@username", Master.getUsername);
            cmdToday.Parameters.AddWithValue("@previousMonth", DateTime.Now.AddMonths(-1).Month);
            SqlDataReader dtrToday = cmdToday.ExecuteReader();
            while (dtrToday.Read())
                renew = false;

            if (renew == true)

by using the parameters to compare

I found the answer. This is the easiest way to do that.

d_now = date()
d = split(DateAdd("d",1,d_now),"/")
s = d(2) & "-" & d(0) & "-" & d(1)

Dim arrParts() As String
Dim theDate As Date

arrParts = Split(strOldFormat, ".")
theDate = DateTime.DateSerial(parts(2), parts(1), parts(0))

strNewFormat = Format(theDate, "mm.dd.yyyy")

Thanks everyone. Problem solved.


Create a new method that mostly used to comparing
Assignment those day, month and year to int variables seperately
then compare.