Skip to main content
Skip table of contents

DateTime

A DateTime value represents a specific point of time. It has all the same features of Date but with the time components hour, minute and second added.  

Related commands

  • setDateTime
    Allows new DateTime values to be created within the logic, such as very easy creation of the date and time on which the logic is being run.

  • setDateTimeFormat
    Used for creating DateTime formats that allow wide customization of how DateTime values are converted into Strings to be displayed on document.

  • setDateTimeParser
    A DateTime parser created by this command can be used to convert Strings into DateTimes.

Methods

Being an extension of the Date value type, DateTime has all the methods of Date in addition to the ones listed here.

getHourOfDay()

Resolves into a Number telling the hour of this DateTime.

For example, the expression ${today.getHourOfDay() == 0} resolves into true if 'today' represents the hour following midnight.

Using the shorthand form the expression becomes ${today.hourOfDay == 0}.

getMinuteOfDay() / getMinuteOfHour()

These two methods resolve into a Number representing the minute of the DateTime in different contexts.

For example, the expression ${today.getMinuteOfHour() >= 30} resolves into true if 'today' is on latter half of its current hour.

Using the shorthand form the expression becomes ${today.minuteOfHour >= 30}.

getSecondOfDay() / getSecondOfMinute()

These two methods resolve into a Number representing the second of the DateTime in different contexts.

For example, the expression ${today.getSecondOfMinute() == 33} would resolve into true only if 'today' represents the 33rd second of its current minute.

Using the shorthand form the expression becomes ${today.secondOfMinute == 33}.

minusHours(value) / minusMinutes(value) / minusSeconds(value)

A set of methods that resolve into a new DateTime that is this DateTime but with the specified number of hours/minutes/seconds earlier in time.

For example, the expression  ${meeting.minusMinutes(30)} resolves into a DateTime that is half an hour earlier than 'meeting'.

plusHours(value) / plusMinutes(value) / plusSeconds(value)

A set of methods that resolve into a new DateTime that is this DateTime but with the specified number of hours/minutes/seconds later in time.

For example, the expression ${moment.plusSeconds(3)} resolves into a DateTime that is three seconds later than 'moment'.  

withHour(value) / withMinute(value) / withSecond(value)

A set of methods that resolve into a new DateTime that is this DateTime but with the hour/minute/second set to the specified number.

For example, the expression ${timestamp.withMinute(0)} resolves into a DateTime that is set to the start of its hour, but is otherwise the same as 'timestamp'.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.