SECOND( ) function

Extracts the seconds from a specified time or datetime and returns it as a numeric value.

Syntax

SECOND(time/datetime)

Parameters

Name Type Description
time/datetime

datetime

The field, expression, or literal value to extract the seconds from.

Output

Numeric.

Examples

Basic examples

Returns 30:

SECOND(`t235930`)
SECOND(`20141231 235930`)

Returns the seconds for each value in the Call_start_time field:

SECOND(Call_start_time)

Remarks

Parameter details

A field specified for time/datetime can use any time or datetime format, as long as the field definition correctly defines the format.

Specifying a literal time or datetime value

When specifying a literal time or datetime value for time/datetime, you are restricted to the formats in the table below, and you must enclose the value in backquotes – for example, `20141231 235959`.

Do not use any separators such as slashes (/) or colons (:) between the individual components of dates or times.

  • Time values – you can use any of the time formats listed in the table below. You must use a separator before a standalone time value for the function to operate correctly. Valid separators are the letter 't', or the letter 'T'. You must specify times using the 24-hour clock. Offsets from Coordinated Universal Time (UTC) must be prefaced by a plus sign (+) or a minus sign (-).

  • Datetime values – you can use any combination of the date, separator, and time formats listed in the table below. The date must precede the time, and you must use a separator between the two. Valid separators are a single blank space, the letter 't', or the letter 'T'.

    Example formats

    Example literal values

    thhmmss

    `t235959`

    Thhmm

    `T2359`

    YYYYMMDD hhmmss

    `20141231 235959`

    YYMMDDthhmm

    `141231t2359`

    YYYYMMDDThh

    `20141231T23`

    YYYYMMDD hhmmss+/-hhmm

    (UTC offset)

    `20141231 235959-0500`

    YYMMDD hhmm+/-hh

    (UTC offset)

    `141231 2359+01`

    Note

    Do not use hh alone in the main time format with data that has a UTC offset. For example, avoid: hh+hhmm. Results can be unreliable.

     

ACL Scripting Guide 14.1