Vigneshwaran Vigneshwaran - 2 years ago 207
Java Question

String to Cassandra Timestamp

I want to convert string date to Cassandra time stamp format

Example date
String inputDate="20170525"

Answer Source

You need to convert your string to Date.
Java Date type maps cassandra timestamp type

DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date date = dateFormat.parse("20170525");

Now you have the date you can insert or query with it in prepared statement

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download