Time from access

Markoleo

Member
Joined
Aug 5, 2006
Messages
19
Programming Experience
Beginner
i have a one problem with time.
in columns show a date 30.12.1899, in all rows.
format time is short time(17:20)
 
The short time (17:20) I think is the one that you see in the database. If you having a problems to format it in the datagrid, you can do in something like this

VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] dgTableStyle [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataGridTableStyle
dgTableStyle = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataGridTableStyle
dgTableStyle.MappingName = [/SIZE][SIZE=2][COLOR=#800000]"work"
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]' Set other properties.
[/COLOR][/SIZE][SIZE=2]dgTableStyle.AlternatingBackColor = Color.LightGray
dgTableStyle.AllowSorting = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] TextCol [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataGridTextBoxColumn
TextCol = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataGridTextBoxColumn
TextCol.MappingName = [/SIZE][SIZE=2][COLOR=#800000]"hour"
[/COLOR][/SIZE][SIZE=2]TextCol.HeaderText = [/SIZE][SIZE=2][COLOR=#800000]"hour"
[/COLOR][/SIZE][SIZE=2]TextCol.Width = 100
TextCol.Format = [/SIZE][SIZE=2][COLOR=#800000]"HH:mm"
[/COLOR][/SIZE][SIZE=2]dgTableStyle.GridColumnStyles.Add(TextCol)
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].DataGrid1.TableStyles.Add(dgTableStyle)
[/SIZE]

If you are using the datagridview, then you can set the properties in the designer to format the column to display hour in "HH:mm" format.
 
Back
Top