Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Dubai, UAE, United Arab Emirates
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Time Formate (Access 2003)

    G'day All

    Is there a way to have time display in table/datasheet view correctly when those times are in excess of 24 hours? For example if I have Total Block Time = 32:45, it displays as 08:45 instead. In excel I'd format the display as [HH]:nn and it'd know to display >23:50 hours. But it doesn't work in Access

    Regards Ken

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Time Formate (Access 2003)

    Access doesn't have a [hh]:mm format. You can use an expression like this in a query:

    Int([Total Block Time]*24) & ":" & Format(([Total Block Time]*1440) Mod 60,"00")

    Explanation: Access stores dates and times as a number of days - dates are the integer part and times the fractional part. The first part of the expression multiplies the time by 24 to get the number of hours, and uses Int to get the number of whole hours. The second part multiplies the time by 24 * 60 = 1440 (the number of minutes in a day) to get the number of minutes, and uses Mod to get the remainder after division by 60, i.e. the number of minutes after removing the whole hours.

    Note: the above expression results in a string; you can't use it for further calculations.

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Dubai, UAE, United Arab Emirates
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Time Formate (Access 2003)

    Thanks Hans.
    I was hoping for a trick to use in the datasheet. For the work I doing the data/subdata sheet view is perfect. It's just the times that are a problem ...
    Regards Ken

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Time Formate (Access 2003)

    Sorry, Access doesn't provide for that.

Posting Permissions

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