# modulo date

**URL:** <https://forum.kx.com/t/modulo-date/10739>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [January 12, 2016, 9:41pm UTC](https://forum.kx.com/t/modulo-date/10739 "2016-01-12T21:41:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximillian\_mur](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@maximillian\_mur](https://forum.kx.com/u/maximillian_mur)\
**Post date:** [January 12, 2016, 9:41pm UTC](https://forum.kx.com/t/modulo-date/10739/1 "2016-01-12T21:41:00Z")

</div>

Hello,

Given that kdb dates are numeric, I am curious why the following \_should\_ not work. &nbsp;I expected it to return 16:59:00. &nbsp;That it doesn’t work is relatively uninteresting as it could simply be an incomplete implementation.

&nbsp; &nbsp; q)40:59:00 mod 24:00:00

&nbsp; &nbsp; k){x-y\*x div y}

&nbsp; &nbsp; 'type

&nbsp; &nbsp; \*

&nbsp; &nbsp; 24:00:00

&nbsp; &nbsp; 00:00:01

&nbsp; &nbsp; q.q))

Best wishes, Max

---

<div class="post-metadata">

**Author:** ![kuentang](https://avatars.discourse-cdn.com/v4/letter/k/bc8723/32.png) [@kuentang](https://forum.kx.com/u/kuentang)\
**Post date:** [January 14, 2016, 11:09pm UTC](https://forum.kx.com/t/modulo-date/10739/2 "2016-01-14T23:09:00Z")

</div>

\<o:p\> \</o:p\>

Multiplication is not defined for time.\<o:p\>\</o:p\>

\<o:p\> \</o:p\>

Here is a workaround:\<o:p\>\</o:p\>

`second$(mod).`long$40:59:00 24:00:00\<o:p\>\</o:p\>

\<o:p\> \</o:p\>

Kim\<o:p\>\</o:p\>

\<o:p\> \</o:p\>

**Von:** [personal-kdbplus@googlegroups.com](mailto:personal-kdbplus@googlegroups.com) [[mailto:personal-kdbplus@googlegroups.com](mailto:personal-kdbplus@googlegroups.com)] **Im Auftrag von** M Murphy  
**Gesendet:** Dienstag, 12. Januar 2016 22:42  
**An:** Kdb+ Personal Developers  
**Betreff:** [personal kdb+] modulo date\<o:p\>\</o:p\>

\<o:p\> \</o:p\>

Hello,\<o:p\>\</o:p\>

\<o:p\> \</o:p\>

Given that kdb dates are numeric, I am curious why the following \_should\_ not work. &nbsp;I expected it to return 16:59:00. &nbsp;That it doesn’t work is relatively uninteresting as it could simply be an incomplete implementation.\<o:p\>\</o:p\>

\<o:p\> \</o:p\>

&nbsp; &nbsp; q)40:59:00 mod 24:00:00\<o:p\>\</o:p\>

&nbsp; &nbsp; k){x-y\*x div y}\<o:p\>\</o:p\>

&nbsp; &nbsp; 'type\<o:p\>\</o:p\>

&nbsp; &nbsp; \*\<o:p\>\</o:p\>

&nbsp; &nbsp; 24:00:00\<o:p\>\</o:p\>

&nbsp; &nbsp; 00:00:01\<o:p\>\</o:p\>

&nbsp; &nbsp; q.q))\<o:p\>\</o:p\>

\<o:p\> \</o:p\>

Best wishes, Max\<o:p\>\</o:p\>

–  
Submitted via Google Groups

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [January 15, 2016, 8:52am UTC](https://forum.kx.com/t/modulo-date/10739/3 "2016-01-15T08:52:00Z")

</div>

q)40:59:00 mod 86400

16:59:00
