i am trying to load a CSV file into my tables where one of field is datetime in table and in CSV is string containing like “Jan 13 2015 8:18AM” values i have tried using $ cast. but did not get any value.
based on a prior suggestion from Attila
q){sum[x[0 1;]]+?[x[2;]=`AM;00:00;12:00]}(“ZTS”;11 5 2)0:(“Jan 13 2015 8:18AM”;“Jan 12 2015 8:18PM”;“Jan 15 2015 8:24PM”)
2015.01.13T08:18:00.000 2015.01.12T20:18:00.000 2015.01.15T20:24:00.000
not always:
q){sum[x[0 1;]]+?[x[2;]=`AM;00:00;12:00]}(“ZTS”;11 5 2)0:(“Jan 13 2015 8:18AM”;“Jan 12 2015 8:18PM”;“Jan 15 2015 11:24PM”)
?length
not having leading zeroes is an insult on mankind
however that can be remedied (much slower than 0: of course)
p:DTS"$'flip(11#;-2_11_;-2#)@:/:
one also be have to be careful with midnight 0am/12am
a: {(x[0]+x[1]modint$12t)+12u*
PM=x 2}
q)a p (“Jan 13 2015 8:18AM”;“Jan 13 2015 0:18AM”;“Jan 13 2015 12:18AM”;“Jan 13 2015 8:18PM”)
2015.01.13D08:18:00.000000000 2015.01.13D00:18:00.000000000 2015.01.13D00:18:00.000000000 2015.01.13D20:18:00.000000000
Cheers,
Attila