At-time test

Learn how to check if a date time is at a specific time of day.

This test checks whether a date or instant is at a specific time of day.

When comparing dates, this test first converts the value to an instant based on the time zone set at the application level. It then checks whether the instant is at the specified time of day.

For more information about how dates are converted to instants, see the section on Date-time conversion.

Syntax

This test has the following syntax:

/*<value>*/ is at /*<time>*/
Try in Playground

To negate the test, you can write:

/*<value>*/ is not at /*<time>*/
Try in Playground

Parameters

These are the supported parameters:

value

The date time to match against the specified time of day.

time

The time of day. This can be a time value or a valid ISO 8601 time string, such as 12:00:00 or 12:00.

Examples

Here is a basic example of how to check whether it is noon:

now is at "12:00" // false
Try in Playground

Because the ISO 8601 standard allows you to omit subcomponents of a time value, you can also write the previous example as:

now is at 12 // false
Try in Playground