MIDNIGHT_SECONDS
Within the specified date, returns the number of seconds between midnight and the date's time portion.
Behavior Type
- Immutable if the
specified date is a
TIMESTAMP
,DATE
, orVARCHAR
- Stable if the specified date is a
TIMESTAMPTZ
Syntax
MIDNIGHT_SECONDS ( date )
Parameters
date |
The date to process, one of the following data types: |
Examples
Get the number of seconds since midnight:
=> SELECT MIDNIGHT_SECONDS(CURRENT_TIMESTAMP); MIDNIGHT_SECONDS ------------------ 36480 (1 row)
Get the number of seconds between midnight and noon on March 3 2016:
=> SELECT MIDNIGHT_SECONDS('3-3-2016 12:00'::TIMESTAMP); MIDNIGHT_SECONDS ------------------ 43200 (1 row)