This saves a space or two in F - I haven't tested it exhaustively, but

I _think_ it applies over the given domain:

    F=:86400%~(3#60)&#.

I don't see how you can avoid converting the string to numeric
before applying F,  so adding a couple of characters back in!

   T=:F inv :: ([:F@". 2 5}~&' ')

   T '02:57:46'

0.123449


I'm not sure what they want to do about rounding,  and do

they want the ":" put back in?

    T 0.05816

1 23 45.024


Bedtime for me!


Mike


On 13/03/2017 17:18, Raul Miller wrote:
This might be shorter:

    F=:86400%~24 60 60#.]
    T=:F inv ::([:F 2 5}~&' ')

    T'12:00:00'
0.5
    T 0.5
12 0 0
    T '12:00:00'
0.5
    T 0.5
12 0 0
    T '12:34:56'
0.524259
    T 0.524259
12 34 55.9776

I hope this helps,




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to