How to Convert Natural Time to TSO

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 如何将自然时间转换为TSO

| username: TiDB超级萌新

Is there any way to convert natural time to TSO?

| username: 像风一样的男子 | Original post link

Convert TSO

SELECT TIDB_PARSE_TSO(445015622227853318);

SELECT conv(concat(bin(unix_timestamp('2022-01-06 12:30:59') * 1000),'000000000000000001'),2,10);
| username: zhanggame1 | Original post link

select REPLACE(unix_timestamp(current_timestamp(3)),'.','') <<18 as current_tso;
| username: lemonade010 | Original post link

Learned and bookmarked.

| username: WinterLiu | Original post link

Ah, a time conversion, it’s so complicated.

| username: TiDBer_lBAxWjWQ | Original post link

Use the pd-ctl tool.

| username: TiDBer_lBAxWjWQ | Original post link

Additionally, refer to the documentation at TiDB 中的 TimeStamp Oracle (TSO) | PingCAP 文档中心

| username: dba远航 | Original post link

SELECT TIDB_PARSE_TSO(445015622227853318); 
SELECT conv(concat(bin(unix_timestamp('2022-01-06 12:30:59') * 1000),'000000000000000001'),2,10);
| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.