我使用ASP.NET從數據庫加載數據以顯示購買的物品的日期,但它也在其旁邊顯示12:00:00 AM的時間戳。投射字符串日期作爲日期
如何打印該值才能顯示日期?
private void UpdateInventory(int index)
{
DataView inventoryTable = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
DataRowView row = (DataRowView)inventoryTable[index];
currentInventory.fac_ID = row["fac_ID"].ToString();
currentInventory.inv_Quantity = row["inv_Quantity"].ToString();
currentInventory.inv_Purchase_Date = row["inv_Purchase_Date"].ToString();
lblFacilityID.Text = currentInventory.fac_ID;
lblQuantity.Text = currentInventory.inv_Quantity;
lblPurchaseDate.Text = currentInventory.inv_Purchase_Date;
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateInventory(DropDownList1.SelectedIndex);
}
public string fac_ID { get; set; }
public string inv_Quantity { get; set; }
public string inv_Purchase_Date { get; set; }