I have a questions about getting the Time field formatted in a gridview. The time in the SQL database shows as a 24hr format, and I need it different. I want 13:00:00 to show up as 1:00 PM. I managed to get this to show in gridview by using the following code in gridview databound event:
If e.Row.RowType = DataControlRowType.DataRow Then
Dim dTime As DateTime
If DateTime.TryParse(e.Row.Cells(0).Text.Trim(), dTime) Then
e.Row.Cells(0).Text = dTime.ToString("h:mm tt")
End If
End If
I actually found this code on another post in these forums. This works great, however I also need this formatted that way when the user edits or inserts a record into the SQL database. I have a formview that is used to insert new records, and the gri ...
Go to the complete details ...