Swadeshi
Swadeshi

Reputation: 1672

what will be data type to store date time in cassandra

what will be data type to store date time in cassandra

CREATE TABLE testTable (
    dateValue date,
    time timestamp
)

n my insert staements would be like this ,

insert into caliper.log_per_day ( timeStampValue,dateValue ) values ('2015-12-30 16:10:31','2015-12-30');

i wanted to store date & time both in one column like this '2015-12-30 16:10:31'. but if i used timestamp it would be store like this '2015-12-30 04:10:31+0530'

Notes : primary key n other things are skip here... ignore it.

Upvotes: 3

Views: 6235

Answers (1)

Albin Mathew
Albin Mathew

Reputation: 604

Cqlsh will display timestamps in the following format by default:

      yyyy-mm-dd HH:mm:ssZ

The Z in these formats refers to an RFC-822 4-digit time zone, If no time zone is supplied, the current time zone for the Cassandra server node will be used.

so if you don't want to store in this way you can store it as varchar.

Upvotes: 2

Related Questions