# substring

**URL:** <https://forum.kx.com/t/substring/6324>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [October 25, 2009, 4:35am UTC](https://forum.kx.com/t/substring/6324 "2009-10-25T04:35:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ninja\_Li](https://avatars.discourse-cdn.com/v4/letter/n/e47c2d/32.png) [@Ninja\_Li](https://forum.kx.com/u/Ninja_Li)\
**Post date:** [October 25, 2009, 4:35am UTC](https://forum.kx.com/t/substring/6324/1 "2009-10-25T04:35:00Z")

</div>

Hi, I have a column with the following format: 09:30 12:30 11:30 … I would like to separate the column into two columns by “:” asfollows: column\_1 column\_2 09 30 12 30 11 30 … Could you tell me what function I should use? Thanks in advance. Ning

---

<div class="post-metadata">

**Author:** ![heydi1](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@heydi1](https://forum.kx.com/u/heydi1)\
**Post date:** [October 25, 2009, 4:53am UTC](https://forum.kx.com/t/substring/6324/2 "2009-10-25T04:53:00Z")

</div>

**vector split**

?

**“:” vs string 09:30**

**?**

2009/10/25 Ninja Li \<nickli2000@gmail.com\>

> Hi,
> 
> ? I have a column with the following format:  
> ? 09:30  
> ? 12:30  
> ? 11:30  
> ? ?..
> 
> ? ?I would like to separate the column into two columns by “:” as  
> follows:  
> ? ?column\_1 ? column\_2  
> ? ? ? ? ?09 ? ? ? ? ? ?30  
> ? ? ? ? ?12 ? ? ? ? ? ?30  
> ? ? ? ? ?11 ? ? ? ? ? ? 30  
> ? ? …
> 
> ? ? Could you tell me what function I should use?
> 
> ? ? Thanks in advance.
> 
> ? ? Ning

---

<div class="post-metadata">

**Author:** ![simon5](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@simon5](https://forum.kx.com/u/simon5)\
**Post date:** [October 25, 2009, 9:22am UTC](https://forum.kx.com/t/substring/6324/3 "2009-10-25T09:22:00Z")

</div>

assuming they’re times, and you’re storing them as times:

> q)tbl:(t:09:30 12:30 11:30)  
> q)tbl  
> t   
> -----  
> 09:30  
> 12:30  
> 11:30  
> q)update h:`hh$t,m:`mm$t from tbl  
> t h m   
> -----------  
> 09:30 9 30  
> 12:30 12 30  
> 11:30 11 30  
> q)

---

<div class="post-metadata">

**Author:** ![Ninja\_Li](https://avatars.discourse-cdn.com/v4/letter/n/e47c2d/32.png) [@Ninja\_Li](https://forum.kx.com/u/Ninja_Li)\
**Post date:** [October 26, 2009, 5:54pm UTC](https://forum.kx.com/t/substring/6324/4 "2009-10-26T17:54:00Z")

</div>

I really appreciate all your help.NingOn Oct 25, 5:22?am, Simon Garland \<simon.garl…\> wrote:\> assuming they’re times, and you’re storing them as times:\>\> \> q)tbl:(t:09:30 12:30 11:30)\> \> q)tbl\> \> t\> \> -----\> \> 09:30\> \> 12:30\> \> 11:30\> \> q)update h:`hh$t,m:`mm$t from tbl\> \> t ? ? h ?m\> \> -----------\> \> 09:30 9 ?30\> \> 12:30 12 30\> \> 11:30 11 30\> \> q)\>\> On 25.10.2009, at 05:35, Ninja Li wrote:\>\>\>\>\>\> \> Hi,\>\> \> ? I have a column with the following format:\> \> ? 09:30\> \> ? 12:30\> \> ? 11:30\> \> ? ?..\>\> \> ? ?I would like to separate the column into two columns by “:” as\> \> follows:\> \> ? ?column\_1 ? column\_2\> \> ? ? ? ? ?09 ? ? ? ? ? ?30\> \> ? ? ? ? ?12 ? ? ? ? ? ?30\> \> ? ? ? ? ?11 ? ? ? ? ? ? 30\> \> ? ? …\>\> \> ? ? Could you tell me what function I should use?- Hide quoted text -\>\> - Show quoted text -\</simon.garl…\>
