1
Answer

Datetime format value of a column of a datarow

Sairam Soham

Sairam Soham

9y
506
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)
0
Abhay Shanker

Abhay Shanker

NA 10.5k 2.4m 11y
Check the Link
0
Sivaraman Dhamodaran

Sivaraman Dhamodaran

NA 61.8k 2.7m 11y
I hope the below article can help in loading the image.
Link