This is a function provided by unix_timestamp()
, but it has been deprecated.
select unix_timestamp() from table_name limit 1;
unix_timestamp(void) is deprecated. Use current_timestamp instead.
OK
1553706841
It suggests to use current_timestamp()
instead, but it does not give epoch time:
select current_timestamp() from table_name limit 1;
OK
2019-03-27 13:14:21.767
What is the recommended way to get current unix epoch time?
You can use unix_timestamp
with a datetime/date argument in a string format to get the epoch.
select unix_timestamp(current_timestamp())
Note that unix_timestamp
function with no arguments has been deprecated since version 2.0, not unix_timestamp(string date)
.