• Subtracting time

    Author
    Topic
    #464165

    Hi,

    I’m trying to figure out total time in a query for a time sheet. I have [starttime] and [endtime] which the user enters data in. The I have [Totaltime] which is a formula. I tried [endtime]-[starttime] but that didn’t give me the correct results. Then I tried

    Totaltime: Format([endtime]-[starttime],”short time”)

    which gives me the correct time. However, when I go to add up the [Dailytime] it doesn’t work. I’m not sure what I’m doing wrong.

    Thanks,
    Leesha

    Viewing 1 reply thread
    Author
    Replies
    • #1187202

      You can use the [endtime]-[starttime] expression. Change the field property to Short Time. Right click on the field and choose properties and enter Short Time for the Format.

    • #1187203

      If the sum of the times is greater than 24 hours, then you won’t be able to display it correctly as time. Times can’t be more than 24 hours because dates and times are stored as decimals with the whole number part representing the Days and the decimal the Hours.

      I usually use something like ([endtime]-[startime])* 24 which converts it from time into a number of hours as a number. They can be added up easily, and give the right answer if multiplied by, say, a rate of pay.

      • #1187352

        If the sum of the times is greater than 24 hours, then you won’t be able to display it correctly as time. Times can’t be more than 24 hours because dates and times are stored as decimals with the whole number part representing the Days and the decimal the Hours.

        I usually use something like ([endtime]-[startime])* 24 which converts it from time into a number of hours as a number. They can be added up easily, and give the right answer if multiplied by, say, a rate of pay.

        That worked perfectly!!!

        Thanks!
        Leesha

    Viewing 1 reply thread
    Reply To: Subtracting time

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: