User Guide Cancel

Second

 

Description

Extracts the ordinal for the second from a date/time object.

Returns

An integer in the range 0-59.

Category

Function syntax

Second(date)
Second(date)
Second(date)

See also

Parameters

Parameter

Description

 

date

A date/time object

 

Usage

When passing a date/time object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date/time object.

Example

<cfscript>
myDatetime = CreateDateTime(2018,11,18,12,39,22);
writeOutput(myDatetime & "<br/>");
writeOutput("the current second is " & Second(myDatetime));
</cfscript>
<cfscript> myDatetime = CreateDateTime(2018,11,18,12,39,22); writeOutput(myDatetime & "<br/>"); writeOutput("the current second is " & Second(myDatetime)); </cfscript>
<cfscript>
    myDatetime = CreateDateTime(2018,11,18,12,39,22);
    writeOutput(myDatetime & "<br/>");
    writeOutput("the current second is " & Second(myDatetime));
</cfscript>

Output

{ts '2018-11-18 12:39:22'}
the current second is 22

Get help faster and easier

New user?