Share via

Convert milliseconds to [h]:mm:ss format

Anonymous
2020-12-09T13:00:32+00:00

I have data that is stored as milliseconds, how can I convert that to the [h]:mm:ss format in access VBA?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
  1. ScottGem 68,810 Reputation points Volunteer Moderator
    2020-12-09T14:12:06+00:00

    Hi RC I'm an independent adviser and will try to help.

    First you need to understand how Access stores date time values. They are stored as a double precision number where the integer portion is the number of days since 12/30/1899 and the decimal portion is a fraction of a day so that 6AM is .25.

    So if a millisecond 1/1000th of a second then there are 60,000 milliseconds in a minute, 3,600,000 milliseconds in an hour and 86,400,000 in a day. So all you need to do is divide the data you have in milliseconds by 86,400,000. Format the result as [h]:mm:ss and you are done.

    Note that if the value is more than 86,400,000, then you have deal with that, by adjusting the hours.

    8 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2020-12-09T14:35:41+00:00

    That was an easy answer thank you!!

    1 person found this answer helpful.
    0 comments No comments