Results 1 to 3 of 3

Thread: Computing Time

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    Computing Time

    ======================

    The value of TextBox1 is 10:24:23 AM and the value of TextBox2 is 11:32:54 AM.

    I am trying to compute the time in VB.NET and I tried this code;

    Dim a As Date
    Dim b As Date
    Dim c As Date

    a = TextBox1.Text
    b = TextBox2.Text

    c = (a - b)

    MessageBox.Show(Format(c, "hh:mm:ss"))

    But I encounter the error: Operator '-' is not defined for types 'Date' and 'Date'

    What's the best thing to do?

  2. #2
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145
    Hi Kabayan,

    Try to look at DateDiff function.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    There is also a Date.Substract function I think....

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