Set-time modifier
Learn how to set the time component of a date-time value.
This modifier changes the time component of a date-time value, leaving the date component unchanged. This is useful when you need to indicate a specific time of day, such as noon or midnight, especially when comparing date-time values.
You can use this modifier with any date-time value, including local date times and instants. In the case of local date times, they are first converted to an instant using the default time zone, and then the time component is set.
Syntax
This modifier has the following syntax:
/*<value>*/ at /*<time>*/
Parameters
These are the supported parameters:
- value
The date-time value for which to set the time component. This parameter is automatically converted to an instant in the configured time zone if necessary.
- time
The time you want to set. 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 get today's date at noon:
today at "12:00"
Because the ISO 8601 standard allows you to omit subcomponents of a time value, you can also write the previous example as:
today at 12