Home > Software design >  Clickhouse now() with milliseconds
Clickhouse now() with milliseconds

Time:05-06

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?

CodePudding user response:

Try now64 function

select now64();

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

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

  • Related