Handling kdb dateTime Formate in Java

347 views
Skip to first unread message

dev12

unread,
Jun 3, 2011, 2:57:23 AM6/3/11
to Kdb+ Personal Developers
Hi,

I have recently started using kdb with Java and also populating data
into kdb.
Almost everything looks fine, apart from handling DateTime

kdb+ wants DateTime in below formate

2011.06.02<< T >> 17:44:11.300 ( with T )

i looked at kdb+
web site [ https://code.kx.com/trac/wiki/Cookbook/InterfacingWithJava
] ,

it says use java.sql.Timestamp
But using it throws exception
java.lang.RuntimeException: Timestamp not valid pre kdb+2.6

Could you please suggest, how we can handle/format DateTime
using Java, hence kdb accept and won't have any issues.

Thanks a Million

dev12

unread,
Jun 3, 2011, 12:26:09 PM6/3/11
to Kdb+ Personal Developers
resolved it :)

used java.util.Date and it worked

SimpleDateFormat smcdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
java.util.Date smcdate = null;
String date = "20110603155110772";
try {
smcdate = smcdf.parse(date);
} catch (ParseException e) {
Reply all
Reply to author
Forward
0 new messages