Results 1 to 5 of 5
  1. #1
    muteninja's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    163
    Reputation
    16
    Thanks
    5
    My Mood
    Confused

    Compare Times Within Listbox

    Hello, anyone know the code for comparing the times inside a list box?
    For example:


    Listbox1 has this inside of it

    ========================
    2013 21-20 20:20:59 blah blah
    2013 21-20 23:20:59 blah blah2
    etc.......
    ========================
    How would i compare times inside the listbox and post the difference inside a label?

    Using Visual Basic

  2. #2
    Geometrical's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    In the middle of nowhere.
    Posts
    1,034
    Reputation
    331
    Thanks
    10,340
    My Mood
    Chatty
    Fortunately theres a function to do so, try this if you're trying to get the difference between the hours...

    The date constructors:
    Code:
    Dim Date1 As Date = #12/20/2013 8:20:59 PM#
    Dim Date2 As Date = #12/20/2013 11:20:59 PM#
    And the function in action:
    Code:
    Label1.Text = DateDif(DateInterval.Hour, Date1, Date2)
    Alternatively, you can convert the times to seconds, subtract them and then change them back to the time format.

  3. The Following User Says Thank You to Geometrical For This Useful Post:

    muteninja (12-21-2013)

  4. #3
    muteninja's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    163
    Reputation
    16
    Thanks
    5
    My Mood
    Confused
    Quote Originally Posted by Geometrical View Post
    Fortunately theres a function to do so, try this if you're trying to get the difference between the hours...

    The date constructors:
    Code:
    Dim Date1 As Date = #12/20/2013 8:20:59 PM#
    Dim Date2 As Date = #12/20/2013 11:20:59 PM#
    And the function in action:
    Code:
    Label1.Text = DateDif(DateInterval.Hour, Date1, Date2)
    Alternatively, you can convert the times to seconds, subtract them and then change them back to the time format.
    You....your a smart one....it's night right now so ill try it tomorrow thanks!

  5. #4
    muteninja's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    163
    Reputation
    16
    Thanks
    5
    My Mood
    Confused
    Quote Originally Posted by Geometrical View Post
    Fortunately theres a function to do so, try this if you're trying to get the difference between the hours...

    The date constructors:
    Code:
    Dim Date1 As Date = #12/20/2013 8:20:59 PM#
    Dim Date2 As Date = #12/20/2013 11:20:59 PM#

    And the function in action:
    Code:
    Label1.Text = DateDif(DateInterval.Hour, Date1, Date2)
    Alternatively, you can convert the times to seconds, subtract them and then change them back to the time format.
    alright i used your code it slightly works....any ideal on how to put the odd items of the list box in one textbox and the evens in another textbox?

  6. #5
    Geometrical's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    In the middle of nowhere.
    Posts
    1,034
    Reputation
    331
    Thanks
    10,340
    My Mood
    Chatty
    Quote Originally Posted by muteninja View Post
    alright i used your code it slightly works....any ideal on how to put the odd items of the list box in one textbox and the evens in another textbox?
    I don't think you're able to recognize even or odd numbers from a string, maybe from any variable declared as an integer perhaps.

Similar Threads

  1. My Time.
    By Dave84311 in forum News & Announcements
    Replies: 8
    Last Post: 11-24-2007, 10:45 PM
  2. i think its time for a new sig
    By darkone1149 in forum Help & Requests
    Replies: 9
    Last Post: 02-06-2006, 03:52 PM
  3. Free Infantry, time to kill it
    By Super-Man in forum General Game Hacking
    Replies: 2
    Last Post: 01-09-2006, 01:58 PM
  4. cap 4 flag in 1 time
    By slash83 in forum WarRock - International Hacks
    Replies: 8
    Last Post: 01-04-2006, 04:24 AM