Seconds to String

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: Seconds to String

27 May 2014, 16:31

joedf wrote:@AlphaBravo Nice there! But I know that it can be even shorter, and you can do it... ;)
I can't get the code any shorter than this ;)

Code: Select all

secsToStr(s){
	return s//86400 " Days, " (s:=mod(s,86400))//3600 " Hours, " (s:=mod(s,3600))//60 " Minutes, " mod(s,60) " Seconds"
}
User avatar
joedf
Posts: 8977
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Seconds to String

27 May 2014, 17:40

Yep! :D (nice)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Seconds to String

27 May 2014, 18:14

AlphaBravo wrote: I can't get the code any shorter than this ;)

Code: Select all

secsToStr(s){
	return s//86400 " Days, " (s:=mod(s,86400))//3600 " Hours, " (s:=mod(s,3600))//60 " Minutes, " mod(s,60) " Seconds"
}
thanks for the straight code! :lol:

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 122 guests