dtSecond#

Purpose#

Extracts the seconds component from a date/time variable as a number (0-59).

Format#

seconds = dtSecond(X[, column])#
Parameters:
  • X (Txk dataframe) – Data with metadata.

  • column (Scalar or string) – Optional, name or index of the date variable in X to get seconds from. Default = first column.

Returns:

seconds (Tx1 vector) – The seconds of the dates in the column specified by column.

Examples#

// Create a date
date_df = asDate("2008-02-16 18:36:29", "%Y-%m-%d %H:%M:%S");

// Get seconds
dtSecond(date_df);

This extracts the seconds:

29

Remarks#

This function only works with dataframes. It does not work with DT Scalars.

See also

Functions dtHour(), dtMinute()