Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009
    Posts
    93

    Unanswered: Calculate Time/Minutes

    Hi folks,

    I'm not sure how to do this.

    I am designing a VB interface where users can select time intervals in blocks of 15mins for specific duties from a drop down (e.g. 15m, 30m, 60mins, 75mins, 90mins etc.)

    What is the best approach for same? What type field should i use in SQL Server 2005?

    I need to add all the time entries for a particular user to see what length of time that user spent on specific duties etc.

    Any help appreciated, thanks

  2. #2
    Join Date
    Oct 2009
    Posts
    93
    Think i found the answer (To use decimals) on the forums like the following:

    1.5 = 1 hour 30 minutes
    2.5 = 2 hours 30 minutes

    What is the best precision setting to use on SQL Server for the Decimal field to achieve my results? The default is 18,0

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,418
    Provided Answers: 7
    I would store the MINS only

    Code:
    Function Mintohrs(Tmin)
        hh = Int(Tmin / 60)
        tt = hh * 60
        mm = Tmin - tt
        Mintohrs = DIG(hh) & ":" & DIG(mm)
    End Function
    
    Function DIG(num)
         if len(num)<>2 then
            DIG ="0" & num 
         else
            DIG = num 
         end if
    End Function
    so

    3:15 = Mintohrs(90+90+15)




    them only show the Time output on the reports.
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •