On Mon, 2 Oct 2006 09:24:37 +0300, "Pitaridis Aristotelis" <pi*******@hotmail.com>
wrote:
>I have a DataGridView which displays some data from a database. One of the
columns contains the time of a event. The problem is that except the time,
it displays the date as well. An example of what I see in every row of the
column is:
30/12/1899 8:45 pm
How can I format the column so that it will display only the time.
For a column named colDate containing a date/time value, format to short time:
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellFormattingEve ntArgs) _
Handles DataGridView1.CellFormatting
If Me.DataGridView1.Columns(e.ColumnIndex).Name = "colDate" Then
e.Value = String.Format("{0:t}", e.Value)
End If
End Sub
Gene