Sairam Soham

Sairam Soham

  • NA
  • 47
  • 28.5k

Datetime format value of a column of a datarow

Jun 3 2015 10:03 AM

In the following for loop row[0].ToString has datetimme value

 foreach (DataRow row in ds.Tables[0].Rows)
            {
               

                   dt.Rows.Add("8W2_Mtr_EndPoint",
                    "EndPointChannelID",
                    "Electric",
                    row[0].ToString()
                   
            
            } //foreach


I want to format this value in the format "yyyy-MM-dd HH:mm".

I tried the following

 row[0].ToString("yyyy-MM-dd HH:mm")

Am I missing something?

 


Answers (1)