second

Returns the seconds in a given string, s.

Syntax

R = second(s)

R = second(s, fmt)

Inputs

s
A string representing a date/time. By default, if no fmt is specified, s is expected to be in the format dd-mmm-yyyy. If in this format, second returns 0.
Type: string
fmt (optional)
Gives the given format that s is in. Valid formats that can return a valid second value are:
  • 'dd-mmm-yyyy HH:MM:SS'
  • 'HH:MM:SS'
  • 'HH:MM:SS PM'
  • 'mmm.dd,yyyy HH:MM:SS'
  • 'yyyymmddTHHMMSS'
  • 'yyyy-mm-dd HH:MM:SS'
Type: string

Outputs

R
Second from the given string s. 0 will be returned for most formats, fmt, which don't specify minutes.
Type: integer

Examples:

Return seconds from a string in a specific date/time format:
R = second('Apr.04,2019 10:11:12', 'mmm.dd,yyyy HH:MM:SS')
R = 12