You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by 土卜皿 <pe...@gmail.com> on 2016/01/07 08:58:09 UTC
How to make the result of select dateof(now) from system.local be
equal to date command ?
Hi, all
When I run the command date:
[root@localhost ~]# date
Thu Jan 7 15:47:32 CST 2016
But under cqlsh, I got a different time:
[root@localhost ~]# cqlsh -u admin -p admin4587 172.21.0.131
Connected to Cassandra Center at 172.21.0.131:9042.
[cqlsh 5.0.1 | Cassandra 2.1.11 | CQL spec 3.2.1 | Native protocol v3]
Use HELP for help.
admin@cqlsh> select dateof(now()) from system.local;
dateof(now())
--------------------------
2016-01-07 07:47:32+0000
(1 rows)
What should I do for getting the same time 15:47:32 other than 07:47:32?
Dillon Peng
Re: How to make the result of select dateof(now) from system.local be
equal to date command ?
Posted by Adam Holmberg <ad...@datastax.com>.
The database timestamp is UTC, which should be the same as date -u on your
system. cqlsh does not convert query results to local timezone, but it
should be easy to do in your application code.
Independent of the above, I'm a little confused by your example because I
would expect CST to be UTC - 06:00, while the example is showing UTC +
08:00. You might want to check the date settings on your local machine and
the database.
Regards,
Adam Holmberg
On Thu, Jan 7, 2016 at 1:58 AM, 土卜皿 <pe...@gmail.com> wrote:
> Hi, all
>
> When I run the command date:
>
> [root@localhost ~]# date
> Thu Jan 7 15:47:32 CST 2016
>
> But under cqlsh, I got a different time:
>
> [root@localhost ~]# cqlsh -u admin -p admin4587 172.21.0.131
> Connected to Cassandra Center at 172.21.0.131:9042.
> [cqlsh 5.0.1 | Cassandra 2.1.11 | CQL spec 3.2.1 | Native protocol v3]
> Use HELP for help.
> admin@cqlsh> select dateof(now()) from system.local;
>
> dateof(now())
> --------------------------
> 2016-01-07 07:47:32+0000
>
> (1 rows)
>
> What should I do for getting the same time 15:47:32 other than 07:47:32?
>
>
> Dillon Peng
>