Display the Current Date, Timestamp and Time in YCQL

We learned in a previous tip one method to display the current timestamp in YCQL.

Luckily the Yugabyte YCQL API makes things a lot easier on the user with built-in functions that return the current date, timestamp and time!

				
					cassandra@ycqlsh> EXPAND ON;
Now Expanded output is enabled

cassandra@ycqlsh> SELECT currentdate(), currenttimestamp(), currenttime() FROM system.local;

@ Row 1
--------------------+---------------------------------
 currentdate()      | 2022-09-29
 currenttimestamp() | 2022-09-29 14:16:54.314000+0000
 currenttime()      | 14:16:54.314873000

(1 rows)
				
			

Note that in the SELECT statements used in the example above is making use of the system.local table as described in a previous YugabyteDB Tip – SIMULATE THE DUAL TABLE IN YCQL

Have fun!