Convert MM:SS to HH:MM:SS

Convert MM:SS to HH:MM:SS

Post by MichelleM » Sat, 16 Aug 2008 03:25:45


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)

--
Message posted via AccessMonster.com
http://www.yqcomputer.com/
 
 
 

Convert MM:SS to HH:MM:SS

Post by John Spenc » Sat, 16 Aug 2008 04:01:10

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

 
 
 

Convert MM:SS to HH:MM:SS

Post by strive4pea » Sat, 16 Aug 2008 04:04:09

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.yqcomputer.com/

*
(: have an awesome day :)
*
 
 
 

Convert MM:SS to HH:MM:SS

Post by John Spenc » Sat, 16 Aug 2008 05:14:18

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
 
 
 

Convert MM:SS to HH:MM:SS

Post by strive4pea » Sat, 16 Aug 2008 05:26:50

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 :)
*