Notice that if you want to establish an order relation that is cyclic you end up with a contradiction. In fact, you get:
0:00 < 23:59 < 0:00.

If you just want to compute distances and you give up with continuity you might proceed as follows.

First, you transform the domain hh:mm in minutes and then linearly map into an integer number between 0 and $2^k-1$. The transformation function might be $$f(h,m)=\mathrm{round}\left(\frac{60h+m}{60\cdot23+59}\times (2^k-1)\right)$$
You can choose $k=10$. It may be better to use less bits than those required to exactly represent time (exact time requires 11 bit if seconds are not used, but not all $2^{11}$ configurations are used).

Then, you encode $f(h,m)$ with a Gray code. Gray code assure that consecutive numbers are encoded in a way that at most one bit is changed; also, the code is cyclic in the sense that the encoding of $0$ and the encoding of $2^k-1$ differ of one bit only.

Finally, you can evaluate the distance between two time instants through bitwise Hamming distance, which counts the number of different bit between two codes.

If you want more precision, you might use seconds accordingly.

Thanks :) but, won't the FT will cause different hours to have the same value? If the transform is

`f(x) -> X`

, then there could be several`x`

with the same`X`

– shakedzy – 2018-01-14T22:57:19.833replying to myself - maybe I'll use the FT and the derivative sign as a second feature to distinguish the ambiguous options.. – shakedzy – 2018-01-14T22:58:50.003

@shakedzy - check my update. I'm not sure about the FT, but the sin / cos transform seems to be the way to go – plumbus_bouquet – 2018-01-14T23:16:04.730

1plumbus_bouquet - a FT is a combination of

`sin`

and`cos`

as real and imaginary parts :) – shakedzy – 2018-01-15T08:32:01.120