• Time Field (Duration) (2002)

    • This topic has 5 replies, 4 voices, and was last updated 23 years ago.
    Author
    Topic
    #371178

    I am a fairly novice Accesser.

    I have an application where I want to track the duration of an event in minutes:seconds. I don’t care whether the colon appears (I can handle that), but I would like to validate correct entries and perform some simple math.

    I tried to use short time (where I would pretend it was mm:ss rather than hh:mm), but that limits me to 24 “minutes”.

    Is there any simple way to do this or am I going to need to code like hell?

    Viewing 1 reply thread
    Author
    Replies
    • #589356

      In a new column in the query use
      TimeDuration: DateDiff(“n”,[Field1], [Field2]) & ” : ” & (DateDiff(“s”,[Field1], [Field2])Mod 60)

      Change Field1 and Field2 to you field names. This assumes the format for your time is hh:nn:ss
      Paul

      • #589363

        While that function will help with the math, what I am really looking to solve is how to store the basic durations. I am not storing a start date/time and an end date/time. I want to store the duration as minutes:seconds (e.g., 124:22 would be 124 minutes and 22 seconds). Math comes later. What is the best format for a column that would hold that type of data?

        • #589369

          Without doing any calculations on the information, you would probably have to store is as TEXT. That is the only way I know of to store it as minutes:seconds. This would certainly affect how you calculate things down the road.
          Paul

        • #589400

          Paul’s right about the difficulties in storing the elapsed time in minutes:seconds. Even as text.

          You might want to consider storing the elapsed time in total seconds, and let your math calculate the minutes:seconds later.

          Tom

    • #589408
    Viewing 1 reply thread
    Reply To: Time Field (Duration) (2002)

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

    Your information: