How can I change Apache Cassandra's default time zone?

北城以北 提交于 2019-12-24 16:04:03

问题


I need to run a Cassandra instance on Windows... Don't ask why...

Anyway the issue is that I have time stamp columns that show datetime in PST time zone but I would like to see GMT time zone. My machine runs with BST time zone(British Summer Time).

Is there a way for me to change the default time zone to GMT?


回答1:


Timestamp values are stored independently from the timezone they have been converted from. Any representation of a TZ will be done by the cqlsh which is depending on Python for the conversion from the TZ agnostic timestamp value to the cqlsh output. Python in turn will use the OS default TZ. In Linux, you can change the TZ by setting the following environment variable in the same shell used to start cqlsh: export TZ='GMT'. I suppose this should work for Windows as well using something like set TZ='GMT'.

Update 11/Feb/2016: described behaviour will not work anymore for 2.1+. See this answer for details.



来源:https://stackoverflow.com/questions/28361233/how-can-i-change-apache-cassandras-default-time-zone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!