how to get only date from string in c#
  • Hi i using below code for fetch data from sql but date column also along with time how can split time and get just date in c# string.
    SqlDataAdapter sda = new SqlDataAdapter("select Date From tblSale", conn);
    DataTable dt = new DataTable();
    string date= dt.Rows[0]["Date"].ToString();
  • 1 Comment sorted by
  • Vote Up-1Vote Down ithackerithacker
    117.50 Karma Accepted Answer
    use below line at end.
    //date is string variable name here
    date = DateTime.Parse(date).ToShortDateString();

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook


Popular Posts of the Week

    Optimum Creative