Results 1 to 5 of 5

Thread: Date/Time

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5

    Question 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.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    DateTime class has a method ToString(), which you can use to format the data in any format you want:

    VB Code:
    1. Dim strMyDate = DateTime.Today.ToString("MM-dd-yyyy")

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5

    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.

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    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.

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5
    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
  •  



Click Here to Expand Forum to Full Width