Convert MM:SS to HH:MM:SS

  • Thread starter MichelleM via AccessMonster.com
  • Start date
M

MichelleM via AccessMonster.com

Here is what I have in my control source to convert seconds to minutes:

=[OtherMediaAHT]\60 & Format([OtherMediaAHT] Mod 60,"\:00")

However, when the minutes are over 60, I will see 74:43, how can I add onto
this to make it convert to hours, as well? (I want to see 01:14:43)
 
J

John Spencer

OtherMediaAHT\3600 will give you hours

OtherMediaAHT\60 MOD 60 will give you minutes

OtherMediaAht Mod 60 will give you seconds

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
S

strive4peace

Hi Michelle,

? TimeSerial(0,74,43)
1:14:43 AM

? Format(TimeSerial(0,74,43),"h:mm:ss")
1:14:43

? Format(TimeSerial(0,0,670),"h:mm:ss")
0:11:10


Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
J

John Spencer

Nice idea, but I see possible problems.

TimeSerial arguments are integer values so if you go beyond 32767 seconds
(your third option) it blows up with an overflow error.

If your total time would exceed 24 hours, you will get erroneous results.
since the hours will revolve around to less than 24.

So that solution is dependent on the data limits.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Hi Michelle,

? TimeSerial(0,74,43)
1:14:43 AM

? Format(TimeSerial(0,74,43),"h:mm:ss")
1:14:43

? Format(TimeSerial(0,0,670),"h:mm:ss")
0:11:10


Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*



Here is what I have in my control source to convert seconds to minutes:

=[OtherMediaAHT]\60 & Format([OtherMediaAHT] Mod 60,"\:00")

However, when the minutes are over 60, I will see 74:43, how can I add
onto
this to make it convert to hours, as well? (I want to see 01:14:43)
 
S

strive4peace

Hi John,

nice to see you <smile>

yes, I should have qualified usage where hour will not go past 24 ...
thanks for adding on

Warm Regards,
Crystal

*
:) have an awesome day :)
*




John said:
Nice idea, but I see possible problems.

TimeSerial arguments are integer values so if you go beyond 32767
seconds (your third option) it blows up with an overflow error.

If your total time would exceed 24 hours, you will get erroneous
results. since the hours will revolve around to less than 24.

So that solution is dependent on the data limits.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Hi Michelle,

? TimeSerial(0,74,43)
1:14:43 AM

? Format(TimeSerial(0,74,43),"h:mm:ss")
1:14:43

? Format(TimeSerial(0,0,670),"h:mm:ss")
0:11:10


Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*



Here is what I have in my control source to convert seconds to minutes:

=[OtherMediaAHT]\60 & Format([OtherMediaAHT] Mod 60,"\:00")

However, when the minutes are over 60, I will see 74:43, how can I
add onto
this to make it convert to hours, as well? (I want to see 01:14:43)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top