# Hour interval (first step)

**URL:** <https://forum.kx.com/t/hour-interval-first-step/12103>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [December 25, 2020, 10:55pm UTC](https://forum.kx.com/t/hour-interval-first-step/12103 "2020-12-25T22:55:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eletrofone1](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@eletrofone1](https://forum.kx.com/u/eletrofone1)\
**Post date:** [December 25, 2020, 10:55pm UTC](https://forum.kx.com/t/hour-interval-first-step/12103/1 "2020-12-25T22:55:00Z")

</div>

Good night!  
Merry Christmas!

I need: 10 items (random) converted to hours and minutes (from 0 to 2 hours)

I coded:

q) **asc 17h$10?0D2**

`s#00:07 00:22 00:26 00:44 00:50 01:00 01:01 01:11 01:16 01:35

I need: 10 items (random) converted to hours and minutes (from 3h10 to 17h25)

I coded:

q)&nbsp;&nbsp; **asc 10?15:10+til`int$17:25 - 15:10**

`s#15:12 15:22 15:40 15:47 15:55 16:12 16:12 16:43 16:58 17:18

Is there a better way to code to get these items?

Thank you for your attention.

---

<div class="post-metadata">

**Author:** ![dotsch1](https://avatars.discourse-cdn.com/v4/letter/d/a4c791/32.png) [@dotsch1](https://forum.kx.com/u/dotsch1)\
**Post date:** [December 26, 2020, 2:42pm UTC](https://forum.kx.com/t/hour-interval-first-step/12103/2 "2020-12-26T14:42:00Z")

</div>

Hi,  
I would simply&nbsp;do:

q) asc 10?02:00

q) asc 03:10+10?17:25-03:10

András

---

<div class="post-metadata">

**Author:** ![eletrofone1](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@eletrofone1](https://forum.kx.com/u/eletrofone1)\
**Post date:** [December 26, 2020, 3:25pm UTC](https://forum.kx.com/t/hour-interval-first-step/12103/3 "2020-12-26T15:25:00Z")

</div>

thank you so much.  
I’ll test now.

Em sáb, 26 de dez de 2020 12:18, András D?tsch \<dotsch@gmail.com\> escreveu:

> Hi,  
> I would simply&nbsp;do:
> 
> q) asc 10?02:00
> 
> q) asc 03:10+10?17:25-03:10
> 
> András
