# time + date = datetime

**URL:** <https://forum.kx.com/t/time-date-datetime/7097>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [April 1, 2011, 4:55pm UTC](https://forum.kx.com/t/time-date-datetime/7097 "2011-04-01T16:55:00Z")\
**Posts on this page:** 6\
**Page:** 1

<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:** [April 1, 2011, 4:55pm UTC](https://forum.kx.com/t/time-date-datetime/7097/1 "2011-04-01T16:55:00Z")

</div>

Hi all,i tried to add time to date, but it fails.What is the most efficient way to do it correctly? I believe that ineed to cast it, but to what type ?String, int,float, symbol are all not working.d:2011.08.12;m:09:00:00;d+m is not working.Thanks for any help.Kim

---

<div class="post-metadata">

**Author:** ![nkoradia](https://avatars.discourse-cdn.com/v4/letter/n/e95f7d/32.png) [@nkoradia](https://forum.kx.com/u/nkoradia)\
**Post date:** [April 1, 2011, 4:57pm UTC](https://forum.kx.com/t/time-date-datetime/7097/2 "2011-04-01T16:57:00Z")

</div>

datetime format has a T between date and time try doing this

2011.08.12T09:00:00

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [April 1, 2011, 5:17pm UTC](https://forum.kx.com/t/time-date-datetime/7097/3 "2011-04-01T17:17:00Z")

</div>

To: [personal-kdbplus@googlegroups.com](mailto:personal-kdbplus@googlegroups.com)  
X-Mailer: Apple Mail (2.1084)

works for me. paste your error

$ q  
KDB+ 2.6 2011.02.04 Copyright (C) 1993-2011 Kx Systems  
l64/

q)d:2011.08.12  
q)m:09:00:00  
q)d+m  
2011.08.12T09:00:00.000

---

<div class="post-metadata">

**Author:** ![f11](https://avatars.discourse-cdn.com/v4/letter/f/2bfe46/32.png) [@f11](https://forum.kx.com/u/f11)\
**Post date:** [April 1, 2011, 5:20pm UTC](https://forum.kx.com/t/time-date-datetime/7097/4 "2011-04-01T17:20:00Z")

</div>

Hello,This works for me in the version I’m using. Not that m is of typesecond (“v”) & not time (“t”). Perhaps this may be causing the issuein the version you’re using.q)d:2011.08.12q)m:09:00:00q)d+m2011.08.12T09:00:00.000q).z.k2011.03.07q).z.K2.7Regards,Fintan.On Apr 1, 11:55?am, kuentang \<kuent…\> wrote:\> Hi all,\>\> i tried to add ?time to date, but it fails.\>\> What is the most efficient way to do it correctly? I believe that i\> need to cast it, but to what type ?\>\> String, int,float, symbol are all not working.\>\> d:2011.08.12;\> m:09:00:00;\>\> d+m is not working.\>\> Thanks for any help.\>\> Kim\</kuent…\>

---

<div class="post-metadata">

**Author:** ![f11](https://avatars.discourse-cdn.com/v4/letter/f/2bfe46/32.png) [@f11](https://forum.kx.com/u/f11)\
**Post date:** [April 1, 2011, 5:20pm UTC](https://forum.kx.com/t/time-date-datetime/7097/5 "2011-04-01T17:20:00Z")

</div>

Hello,This works for me in the version I’m using. Not that m is of typesecond (“v”) & not time (“t”). Perhaps this may be causing the issuein the version you’re using.q)d:2011.08.12q)m:09:00:00q)d+m2011.08.12T09:00:00.000q).z.k2011.03.07q).z.K2.7Regards,Fintan.On Apr 1, 11:55?am, kuentang \<kuent…\> wrote:\> Hi all,\>\> i tried to add ?time to date, but it fails.\>\> What is the most efficient way to do it correctly? I believe that i\> need to cast it, but to what type ?\>\> String, int,float, symbol are all not working.\>\> d:2011.08.12;\> m:09:00:00;\>\> d+m is not working.\>\> Thanks for any help.\>\> Kim\</kuent…\>

---

<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:** [April 1, 2011, 5:45pm UTC](https://forum.kx.com/t/time-date-datetime/7097/6 "2011-04-01T17:45:00Z")

</div>

Thanks for all the reply so far.This is roughly the Code that creates the Error{select d +m from x} select by d,1 xbar t.minute from ( t:.z.t+til10; d:.z.d+Til 10)and it Works on my Personal machine but Not on that from the work.I believed As indicated by finqtang this is a Minute and Date issue.Thanks for all the commentsOn 1 Apr., 18:20, fintanq \<fint…\> wrote:\> Hello,\>\> This works for me in the version I’m using. Not that m is of type\> second (“v”) & not time (“t”). Perhaps this may be causing the issue\> in the version you’re using.\>\> q)d:2011.08.12\> q)m:09:00:00\> q)d+m\> 2011.08.12T09:00:00.000\> q).z.k\> 2011.03.07\> q).z.K\> 2.7\>\> Regards,\>\> Fintan.\>\> On Apr 1, 11:55?am, kuentang \<kuent…\> wrote:\>\>\>\> \> Hi all,\>\> \> i tried to add ?time to date, but it fails.\>\> \> What is the most efficient way to do it correctly? I believe that i\> \> need to cast it, but to what type ?\>\> \> String, int,float, symbol are all not working.\>\> \> d:2011.08.12;\> \> m:09:00:00;\>\> \> d+m is not working.\>\> \> Thanks for any help.\>\> \> Kim\</kuent…\>\</fint…\>
