1
Answer

Datetime format value of a column of a datarow

Sairam Soham

Sairam Soham

9y
8.8k
1

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)