• 1.9k
  • 99
  • 3.5k

Remove Datetime By query to show inLabel or Textbox

Aug 24 2018 1:17 PM
 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.

Brought to you by:

Answers (4)