0

I am inserting the data from C# to Cassandra cluster in IST ('2015-12-28') format. But when i query the same data using cqlsh. It gives me in '2015-12-27 18:30:00+0000' format. So, to change the format i have tried some of the suggestion but couldn't get succeed like addition of TZ='IST' in cqlshrc file. specify cqlsh output timezone

So, how to change the timezone to be IST and get the value like this '2015-12-27 05:30:00+0000'.

Community
  • 1
  • 1
Naresh
  • 5,073
  • 12
  • 67
  • 124
  • Have you tried using the actual time zone ID instead of IST? Try `TZ=Asia/Kolkata` (It's not clear why you put the quotes round IST either...) – Jon Skeet Dec 28 '15 at 12:51
  • Possible duplicate of [Cassandra : CQLSH not displaying correct timezone](http://stackoverflow.com/questions/32778433/cassandra-cqlsh-not-displaying-correct-timezone) – Aaron Dec 28 '15 at 14:51

2 Answers2

1

making cqlsh to display timestamp in local timezone. Install pytz

sudo apt-get install python-tz

And then configure cqlshrc file where we can specify timezone and output time format

nano .cassandra/cqlshrc
[ui]
timezone = Asia/Kolkata
time_format = %Y-%m-%d %H:%M:%S%z
charybr
  • 1,888
  • 24
  • 29
0

You can use the following time_format as required

yyyy-mm-dd HH:mm, yyyy-mm-dd HH:mm:ss, yyyy-mm-dd HH:mmZ, yyyy-mm-dd HH:mm:ssZ, yyyy-mm-dd'T'HH:mm, yyyy-mm-dd'T'HH:mmZ, yyyy-mm-dd'T'HH:mm:ss, yyyy-mm-dd'T'HH:mm:ssZ, yyyy-mm-dd, yyyy-mm-ddZ,

by setting the time_format property in the [ui] section of the cqlshrc file.