SECOND

The SECOND function returns the second of a time or datetime value as an integer from 0 to 59.

Syntax

SECOND(
    datetime
)

Parameters
  • datetime: Value corresponding to a date and time, or to a time, such as 15:35:28 or 5:16 PM, from which the second is to be extracted.
Returned value

The SECOND function returns an integer from 0 to 59.

Additional Information

Even though the SECOND function requires a datetime type argument, it can receive as an argument a real number (in which the integer part is considered as a reference to the date and the decimal part as a reference to the time), with general or any other format (date and time or other). In other words, the SECOND function takes both a time and a datetime value as an argument. In the case of receiving a datetime value as an argument, the day, month and year values are ignored, and only the value of the second is extracted.

The datetime argument can be passed to the function using a create date/time function, a function that returns a date/time value, as a reference to a column containing date/time values, or by directly entering the date/time value in any of the accepted formats. In the latter case, the SECOND function will use the regional configuration and the date and time settings of the client computer in order to interpret the text from which to extract the appropriate value. In this way, the following functions (which receive the same real number as an argument with a different format), will return the same value: 14.

second = SECOND("10/15/2016 11:9:14")

second = SECOND(42658,4230787037)

Examples

The following example extracts the second from the field that contains the date and time of the sales:

SECOND function: Example of use

Related functions
Category
Date and time
Submitted by admin on Tue, 12/04/2018 - 00:02