SetSecond

Description

Sets the second on the Date object. This is a member function called by the Date object.

Returns

DateObject

History

New in Adobe ColdFusion (2016 release)

Category

Date and time functions

Syntax

setSecond(second)

Parameter

Parameter

Description

second

Required. An integer representing the seconds.

Expected values are 0-59, but other values are allowed:

  • -1 results in the last second of the previous minute
  • 60 results in the first second of the next minute

Example

<cfscript>
       myDate=now();
       WriteOutput(myDate.setSecond(55) & "<br/>");
       WriteOutput(myDate.setSecond(-1) & "<br/>");
       WriteOutput(myDate.setSecond(60) & "<br/>");
</cfscript>

Output

{ts '2018-11-08 05:57:55'}
{ts '2018-11-08 05:56:59'}
{ts '2018-11-08 05:57:00'}

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online