在我的网站上,当用户登录时,他看到一个“我的帐户”页面。这些信息保存在SQL数据库中。仅转换日期到字符串
C#的部分(相关代码只):
public partial class myaccount : System.Web.UI.Page
{
public string username;
public string birthday;
protected void Page_Load(object sender, EventArgs e)
{
username = (string)Session["user"];
string sql = "select * from users where username='" + username + "'";
DataTable table = Eitan.ExecuteDataTable("database.mdf", sql);
birthday = table.Rows[0]["birthday"].ToString();
}
}
在HTML相关表格行:
<tr>
<th>Birthday: </th>
<td><%=birthday %></td>
</tr>
一切正常,除了生日值。其显示为: 7/8/1964 12:00:00 AM
怎么可以我摆脱了小时?谢谢!
什么格式你想完全展示它? –