4
Answers

Remove Datetime By query to show inLabel or Textbox

Shweta68

Shweta68

6y
814
1
Hello
 I have a column RegDate(Datetime). When I select it by query then it gives me data like : 2018-08-23 23:42:48.300
 I need to display the Date only. For this I write following code its working properly.
 
string RegDate = dt1.Rows[0]["RegDate"].ToString();
DateTime dRegDate = Convert.ToDateTime(RegDate);
lblRegDate.Text = dRegDate.ToString("dd MMM yyyy"); 
 
Can I solve it in one line or I can change it by query?
 
Kindly help me.
Answers (4)