Time.Second

Time

Returns the second component from a time, datetime, or datetimezone value.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Time.Second(dateTime as any) as nullable number

Parameters

NameTypeRequiredDescription
dateTimeanyYesThe time, datetime, or datetimezone value to extract the second from.

Return Value

numberThe second component (0 through 59).

Remarks

Time.Second returns the second component as a number from 0 to 59 from a time, datetime, or datetimezone value. If the input is null, the function returns null.

Examples

Example 1: Extract second from OrderLog Timestamp

Table.AddColumn(
    Table.SelectColumns(
        Table.FirstN(OrderLog, 4),
        {"LogID", "Timestamp"}
    ),
    "Second", each Time.Second([Timestamp]), Int64.Type
)
Result
LogID
Timestamp
Second
1L0011/15/2024 9:30:00 AM0
2L0021/16/2024 2:15:00 PM0
3L0031/18/2024 11:00:00 AM0
4L0041/20/2024 8:45:00 AM0

Example 2: Extract second from a scalar time

#table(
    type table [Time = time, Second = number],
    {{#time(14, 30, 45), Time.Second(#time(14, 30, 45))}}
)
Result
Time
Second
114:30:4545

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks