|
-
Oct 21st, 2002, 01:25 PM
#1
Thread Starter
New Member
Date/Time
Hi All,
I need some help with my programming assignment. I used VB.NET database wizard to generate a data form. The problem is that when I set the data type in MS Access to Date/Time and select the format to be Short Date. The data form generated by VB.NET will show the date as a General Date datatype. Hence it looks like that 9/9/2002 12:00:00AM. However, what I want is just 9/9/2002 without the time behind the date.
What shoould I do?
Thanx.
-
Oct 21st, 2002, 02:23 PM
#2
DateTime class has a method ToString(), which you can use to format the data in any format you want:
VB Code:
Dim strMyDate = DateTime.Today.ToString("MM-dd-yyyy")
-
Oct 21st, 2002, 02:54 PM
#3
Thread Starter
New Member
hot to implement?
Hi Serge,
I appreciate your tip. I however do not know how to implement it in the program. These are 2 places that date appears in my program. Can anybody help?
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Date", System.Data.OleDb.OleDbType.DBDate, 0, "Date"))
'
'editDate
'
Me.editDate.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.objreservations, "reservations.Date"))
Me.editDate.Location = New System.Drawing.Point(168, 296)
Me.editDate.Name = "editDate"
Me.editDate.TabIndex = 3
Me.editDate.Text = ""
Thanx.
-
Oct 21st, 2002, 04:03 PM
#4
Frenzied Member
Those parts you have written are not that relevant. By the way what you mean by 'data form generated by VB.NET' ? Are you trying to show your data in a textbox or ....what? define more clearly.
-
Oct 21st, 2002, 10:38 PM
#5
Thread Starter
New Member
Hi,
Sorry, I'm still new to VB therefore I am not able to explain my question well enough.
OK let me be more explicit. I use the Data Form Wizard to generate a Form that has its textboxes link to a MS Access 2002 database table. The problem with 1 date field is that, time is displayed after the date ... and yes! this is displayed in a textbox.
When I view data in MS Access itself the date was displayed correctly without the time behind.
I really hope this is clear.
Thanx.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|