VAN VAN - 6 days ago 7
MySQL Question

vb.net DateTimePicker remove time 12:00:00 AM

im having a problem when viewing date on my listview.

on my SQL its okay that on my column "2016-28-11" that is fine
but when i view it on my listview in vb.net it said that "2016-28-11 12:00:00 am"

on my datetimepicker

Value: 11/28/2016
custom format: yyyy-MM-dd
format: custom

when i save the date it adds that time. can anyone help me?

Answer

When you add the date in your listview just use something like that:

 Dim NewItem As New ListViewItem
 NewItem.Text = "My Item"
 NewItem.SubItems.Add(mydate.tostring("yyyy-MM-dd"))
 ListView1.Items.Add(NewItem)

Just keep in mind mydate.tostring("yyyy-MM-dd") where mydate is a datetime.

Considerate your comments, here is the code:

.SubItems.Add(ds.Tables("studnum").Rows(i).Item(4).ToString)
Dim MyDate As DateTime = Date(ds.Tables("studnum").Rows(i).Item(5).ToString)
.SubItems.Add(MyDate.ToString("yyyy-MM-dd"))
Comments