Friday, February 10, 2012

Convert the time to 24hr format in asp.net

string[] strSTime =Convert.ToDateTime(Convert.ToDateTime(dview[0]["StartDtTime"]).ToShortTimeString()).ToString("H:mm").Split(":".ToCharArray());--Here dview means dataview

txtSDate.Text = Convert.ToDateTime(Convert.ToDateTime(txtDate.Text).ToShortDateString()).ToString("dd/MM/yyyy");--Converting date into dd/MM/yyyy format

rbl_test.SelectedValue = dview[0]["IsolationType"] == true ? "1" : "2";


TimeSpan ts;
ts = Convert.ToDateTime(Convert.ToDateTime(dview[0]["FinishDtTime"]).ToShortDateString()) - Convert.ToDateTime(Convert.ToDateTime(dview[0]["FromDate"]).ToShortDateString());--Calculating days using timespan in asp.net

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software