atMidnight
atMidnight returns an instant for the requested input value at midnight in the specified time zone.
Syntax
atMidnight(instant, timeZone)
atMidnight(dateTime)
Parameters
| Parameter | Type | Description |
|---|---|---|
| instant | Instant | The time to compute the prior midnight for. |
| timeZone | ZoneId | The time zone for which the new value at midnight should be calculated. |
| dateTime | ZonedDateTime | The time to compute the prior midnight for. |
Returns
Returns either an Instant or a ZonedDateTime for the prior midnight in the specified time zone.
Examples
datetime = parseInstant("2023-01-01T00:05:00 ET")
mt = timeZone("MT")
datetime_zoned = toZonedDateTime(datetime, mt)
println atMidnight(datetime, mt)
println atMidnight(datetime_zoned)