SECOND

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the seconds field from a timestamp or interval. This function is equivalent to EXTRACT(SECOND FROM ...).

Syntax 

1second(<timestamp>)
1second(<interval>)

Arguments 

Required 

  • <timestamp>: The timestamp to extract the seconds from.
  • <interval>: The interval to extract the seconds from.

Returns 

Returns the seconds as a numeric.

Examples 

Extract the Seconds from a Timestamp 

Get the seconds field, including fractional parts, from a timestamp.

1SELECT second(timestamp '2001-02-16 20:38:40.500') AS result;

Returns 40.500.

Extract the Seconds from an Interval 

Get the seconds component from an interval.

1SELECT second(interval '21 seconds') AS result;

Returns 21.0.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!