For example:
dt: 2013.07.04T14:17:15.000
I want to get:
time:14:17:15.000
which function can make it?
floor() function can get date: 2013.07.04, but how about time?
Thanks,
Roy.
For example:
dt: 2013.07.04T14:17:15.000
I want to get:
time:14:17:15.000
which function can make it?
floor() function can get date: 2013.07.04, but how about time?
Thanks,
Roy.
“t”$dt
Thanks, Ye Tian. This is the answer :)
However, ?t?$dt is a cast operation. Is there any function to get the same thing?
See cast $ in docs
`time$2013.07.04T14:17:15.000
Hi, Manish
However, ?t?$dt is a cast operation. Is there any function to get the same thing?
“t” and `time do the same thing here. $ is the cast function. If you’re looking for a more readable name, you can make one up
q)cast:$
q)cast[“t”;2013.07.04T14:17:15.000]
14:17:15.000
q)cast[`time;2013.07.04T14:17:15.000]
14:17:15.000
Since 3.0
you should see an error
q)floor dt
'use “d”$
so if outside a function, you can do
q)dt.date
2013.07.04
q)dt.time
14:17:15.000
which under the covers are the equivalent of
q)“d”$dt
2013.07.04
q)“t”$dt
14:17:15.000
which also work inside functions. date$ and
time$ are also equivalent but slightly slower.
Dot notation does not work inside functions, unless inside select/exec/update.
Charles,
Thank you!
To: personal-kdbplus@googlegroups.comX-Mailer: Apple Mail (2.1283)also note if you’re in a version that has timespan/timestamp, you should avoid datetime if at all possibleOn Nov 21, 2013, at 9:00 AM, liuchuanbo@gmail.com wrote:> Charles,> > Thank you!> > On Nov 21, 2013, at 5:25 PM, Charles Skelton wrote:> >> Since 3.0>> you should see an error>> q)floor dt>> 'use “d”$>> >> so if outside a function, you can do>> >> q)dt.date>> 2013.07.04>> q)dt.time>> 14:17:15.000>> >> which under the covers are the equivalent of>> q)“d”$dt>> 2013.07.04>> q)“t”$dt>> 14:17:15.000>> which also work inside functions. date$ and
time$ are also equivalent but slightly slower.>> Dot notation does not work inside functions, unless inside select/exec/update. >> >> >> On Thu, Nov 21, 2013 at 3:57 AM, wrote:>> For example: >> dt: 2013.07.04T14:17:15.000>> >> I want to get:>> time:14:17:15.000>> >> which function can make it?>> >> floor() function can get date: 2013.07.04, but how about time?