Results 1 to 5 of 5

Thread: subtraction of time

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    subtraction of time

    URGENT ::::::

    I have a drop down box showing
    0 minutes
    5 minutes
    10 minutes
    1 hour
    2 hours etc etc

    i then have another drop down box with
    00:00
    00:30
    01:00 etc etc

    i want to be able to subtract the first amount of time from the second i know i will need a case statment on the first one saying something allong the lines of

    select case me.blah.selectedValue
    case 1 'remove 5 minutes from time

    BLAH = my new time which should be 00:25

    end select

    what do i do to subtract time ive seen that datediff can handle time but when ever i try it buggers up
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    I'd use date diff. Post some code if you get an error and we'll try and sort it for you.
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  3. #3

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539
    the code is pretty set up but heres all the info

    i have a combo called StartTime and another one called reminder time

    StartTime has values of every 30 minutes starting from 00:00 to 23:30

    ReminderTime is like

    0 Minutes
    5 minutes
    10 minutes
    15 minutes
    - rest skipped
    1 hour
    2 hours
    - rest skipped
    1 Day
    2 day
    etc

    So i would do this

    Dim dte_ReminderTime
    Select Case Me.ReminderTime.SelectedIndex
    Case 0 ' Subtract Nothing
    Case 1 'Subtract five minutes
    dte_ReminderTime = StartTime - 5 minutes (this is what im not sure of )
    Case 2 'Subtract 10 minutes

    End Select
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  4. #4
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    it's dateadd you wanna use sorry.

    Code:
    Dim temp As Date
    temp = DateAdd(DateInterval.Minute, -5, #9:00:00 AM#)
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can also check out the timespan object:
    http://www.vbforums.com/showthread.p...hreadid=270761

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