cnosdb如何将当前时间直接转换为时间戳

huangapple go评论48阅读模式
英文:

How does cnosdb convert the current time directly into a timestamp

问题

cnosdb如何将当前时间直接转换为时间戳
我获取时间的方式如下

select now();
+-----------------------------+
| now()                       |
+-----------------------------+
| 2023-05-15T07:20:55.265027Z |
+-----------------------------+
Query took 0.005 seconds.

但我想直接获取时间戳,应该如何获取?

英文:

How does cnosdb convert the current time directly into a timestamp
I get the time as follows

select now();
+-----------------------------+
| now()                       |
+-----------------------------+
| 2023-05-15T07:20:55.265027Z |
+-----------------------------+
Query took 0.005 seconds.

But I want to get the timestamp directly.how can i get it?

答案1

得分: 1

Later, I checked some information and found that the data can be changed to timestamp in this way:

public  select cast(now() as bigint);
+---------------------+
| now()               |
+---------------------+
| 1684290575284788126 |
+---------------------+
Query took 0.002 seconds.
英文:

Later, I checked some information and found that the data can be changed to timestamp in this way:

public ❯ select cast(now()as bigint);
+---------------------+
| now()               |
+---------------------+
| 1684290575284788126 |
+---------------------+
Query took 0.002 seconds.

huangapple
  • 本文由 发表于 2023年5月15日 15:25:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76251760.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定