Function is_timestamp

The function checks strings for being a timestamp.
You might pass a second parameter to use a format string. Without the format, the default format of PostgreSQL is used.

There has been a behaviour change in PostgreSQL 10. A conversion is now handled strict, as in previous versions the conversion tried to calculate a date.

Examples

/**
 * Parameter is in PostgreSQL default format
 */
SELECT is_timestamp('2018-01-01 00:00:00') AS res;

Result:

res
t
SELECT is_timestamp('2018-01-01 25:00:00') AS res;
-- Result is false in PostgreSQL >= 10

Result:

res
f
/**
 * Parameter is in PostgreSQL German format
 */
SELECT is_timestamp('01.01.2018 00:00:00', 'DD.MM.YYYY HH24.MI.SS') AS res;

Result:

res
t
SELECT is_timestamp('01.01.2018 25:00:00', 'DD.MM.YYYY HH24.MI.SS') AS res;

Result:

res
f