我有一個vb.net數據表 數據是由用戶輸入,因此沒有涉及SQL表。datatable短日期格式
當我存儲的「2016年2月1日」到數據表和吐回來了,它顯示爲「2016年2月1日12:00:00 AM」
什麼是最好的方式格式化這回 「2016年2月1日」
Dim table As New DataTable
table.Columns.Add("Date", GetType(DateTime))
table.Rows.Add("2/1/2016")
debug.print (table.rows(0)("Date").tostring)
感謝
一個DateTime總是有一個日期和時間。使用顯示機制僅顯示日期 – Plutonix
我嘗試使用getType(日期),但我仍然得到「2/1/2016 12:00:00 AM」 – BobNoobGuy
將*總是*是結構的時間元素。 'Debug.Print(Convert.ToDateTime(table.Rows(0)(「Date」))。ToShortDateString)' – Plutonix