kumartyr

kumartyr

  • NA
  • 55
  • 27.9k

how can get the date in this format "31-jun-2013"

Aug 14 2013 6:00 AM
how can i get the date in this format "31-jun-2013" 

at runtime if user type in the above format in the textbox ..it will fetch the matching rows of data for the specified date and filter that and show in datagridview 

so for that i want to compare the date format with the text typed in textbox

   string todaydate = Convert.ToString(DateTime.Today);

   DateTime DTM = Convert.ToDateTime(Date);

   string datetoday = DTM.ToString("dd-MMM-yyyy");

if (TypeHereTextBox.Text == datetoday)

{
OLCMND2 = new OracleCommand("Select * from TABLENAME where DATE = '" + TypeHereTextBox.Text + "'", CON);

                    OADAP1 = new OracleDataAdapter(OLCMND2);
                    OADAP1.Fill(DTBLE2);

                    DatagridView.DataSource = DTBLE2;
}

how can it be solved 

Answers (11)