Decimal Time of Day Conversion

CJam, 58 56 42 bytes

I am sure this is too long and can be golfed a lot. But here goes for starters:

86400q':/:d_,({60bd\/}{~*i60b{s2Ue[}%':*}?

Try it online here


Python 2, 159 150 141 + 2 = 143 Bytes

Straightforward solution, can probably be much shorter. Will work on it.

Added two bytes to account for input needing to be enclosed in "s. Also, Sp3000 pointed out an issue with eval() interpreting octals, and showed a way to shorten formatting, use map() and remove one print.

n=input();i=float;d=864e2
if':'in n:a,b,c=map(i,n.split(':'));o=a/24+b/1440+c/d
else:n=i(n);o=(':%02d'*3%(n*24,n*1440%60,n*d%60))[1:]
print o

Check it out on ideone here.


Javascript (ES6), 116 110 bytes

f=x=>x[0]?([h,m,s]=x.split(':'),+s+m*60+h*3600)/86400:[24,60,60].map(y=>('0'+~~(x*=y)%60).slice(-2)).join(':')


// for snippet demo:
i=prompt();
i=i==+i?+i:i; // convert decimal string to number type
alert(f(i))

Commented:

f=x=>
    x[0] ? // if x is a string (has a defined property at '0')
        ([h, m, s] = x.split(':'), // split into hours, minutes, seconds
        +s + m*60 + h*3600) // calculate number of seconds
        / 86400 // divide by seconds in a day
    : // else
        [24, 60, 60]. // array of hours, minutes, seconds
        map(y=> // map each with function
            ('0' + // prepend with string zero
                ~~(x *= y) // multiply x by y and floor it
                % 60 // get remainder
            ).slice(-2) // get last 2 digits
        ).join(':') // join resulting array with colons