Note: cqlsh converts timestamps into current timezone
You can prove this manually:
$ cqlsh
cqlsh> CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> use mykeyspace;
cqlsh> CREATE TABLE objects (id int PRIMARY KEY, name text, date timestamp);
cqlsh> INSERT INTO objects (id, name, date) VALUES (1, 'one', '2010-01-01T00:00:00Z');
cqlsh> SELECT * FROM objects;
id | date | name
----+--------------------------+------
1 | 2009-12-31 17:00:00-0700 | one
Workaround:
$ TZ=UTC cqlsh
cqlsh> use mykeyspace;
cqlsh:mykeyspace> SELECT * FROM objects;
id | date | name
----+--------------------------+------
1 | 2010-01-01 00:00:00+0000 | one
You can change the format (not the TZ, AFAIK) in the ~/.cassandra/cqlshrc
file like this:
$ mkdir -p ~/.cassandra
$ cat > ~/.cassandra/cqlshrc <<DOC
[ui]
time_format=...%Y-%m-%d.%H:%M:%S...
DOC
$ cqlsh
cqlsh> use mykeyspace;
cqlsh:mykeyspace> SELECT * FROM objects;
id | date | name
----+---------------------------+------
1 | ...2009-12-31.17:00:00... | one
Fun fact: if you make a ~/.cqlshrc
file and change some settings as above then the next time you run cqlsh those configs will be loaded and then saved into ~/.cassandra/cqlshrc
. This process removes ~/.cqlshrc
so don't be too suprised when it has gone missing. o_O