Ivan1
April 12, 2013, 1:12pm
1
Hi all!
In my csv file date is stored as 20130315185540686 (meaning 2013.03.15T18:55:40.686).
Is there a possibility to convert that string into datetime “on the run” during the reading process? Or perhaps split it into two separate date and time columns?
I am using following string to read csv file:
.Q.fs[{:tst/orderlog/ upsert .Q.en[
:tst] flip symbol
systyp
momentid
actionprice
volumeid_deal
price_dealown
account!(“SCCJJIFIJFIS”;“,”)0:x}]`:3.csv
Thank you.
update date:“D”$8#'date,time:“T”$-9#'date from ( date:10#enlist “20130315185540686”)
so embed it like
.Q.fs[{:tst/orderlog/ upsert .Q.en[
:tst] update “D”$8#'date,time:“T”$-9#'date from flipsymbol
systyp
momentid
actionprice
volumeid_deal
price_dealown
account!(“SCCJJIFIJFIS”;“,”)0:x}]`:3.csv
I dont know which of your col names
symbol
systyp
momentid
actionprice
volumeid_deal
price_dealown
account
refers to date[time] though… so I just called it date; change it as necessary.
btw, for this use type id “*” to read the date[time] column from the csv
Ivan1
April 12, 2013, 1:57pm
4
Thank you,
seems I can make it work after some effort
Or you can do:
update “Z”$((8#‘date),’“T”,/:(-9#'date)) from ( date:10#enlist “20130315185540686”)
.Q.fs[{:tst/orderlog/ upsert .Q.en[
:tst] update “Z”$((8#‘date),’“T”,/:(-9#'date)) from flipsymbol
systyp
momentid
actionprice
volumeid_deal
price_dealown
account!(“SCCJJIFIJFIS”;“,”)0:x}]`:3.csv
Ivan1
April 12, 2013, 2:32pm
6
I have made it almost same
update (“D”$8#'moment)+(“T”$-9#'moment)
Is it a good approach?
Attila
April 12, 2013, 2:43pm
7
update sum(“DT”;8 9)0:date from
is a bit faster (no each) and shorter
Cheers,
Attila
I think this is fine, as long as the type of the result is what you need (well you result will end up to be time stamp type)…
But you can easily recast it anyway… So you’re good!! :)