Mícéal Gallagher in P/sql 1 minutes

Postgres - Get the current time in milliseconds

To get the current time in milliseconds you can use the following:

```pgsql(SELECT extract(epoch FROM clock_timestamp())) * 1000


**Notice that you need to multiply the answer by 1000.*
If you need to store this value in a variable, you need to use the datatype *double precision* which has the alias float8:

```default...
DECLARE
    timeInMilli float8;
BEGIN
    timeInMilli := (SELECT extract(epoch FROM clock_timestamp())) * 1000;
...