Code archives/Algorithms/CONVERTIR A HH:mm:ss (Time hour minute seg)

This code has been declared by its author to be Public Domain code.

Download source code

CONVERTIR A HH:mm:ss (Time hour minute seg) by virtualjesus2010
CONVERTIR Segundos a HH:mm:ss (Time hour minute seg)
Function UnidadTiempo$(s)
	Local d=0,h=0,m=0
	If s>0
		If s>86399 Then d=Floor(s/86400):s=s-(d*86400)
		If s>59 Then m=Floor(s/60):s=s-(m*60)
		If m>59 Then h=Floor(m/60):m=m-(h*60)
		If d>0
			Return d+"d : "+h+"h : "+m+"m : "+s+"s"
		Else
			If h>0
				Return h+"h : "+m+"m : "+s+"s"
			Else
				If m>0 Then Return m+"m : "+s+"s" Else Return s+"s"
			EndIf
		EndIf
	EndIf
End Function

Comments

virtualjesus2010
Se me olvidaba, también convierte a días.
Formato DD:HH:mm:ss


Code Archives Forum