'Clickhouse now() with milliseconds

I'm trying to get a current datetime in the Clickhouse. There is function now() that could I use but the precision is just in seconds

select now();
-- result 2022-05-05 10:34:48


select toUnixTimestamp(now());
-- result 1651746940

Any idea how could I get the current datetime with a milliseconds precision?



Solution 1:[1]

Try now64 function

select now64();

-- 2022-05-05 10:57:32.953

There are related -64 functions like toUnixTimestamp64Milli() etc.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 simPod