atBeginningOfDay

atBeginningOfDay(dateTime: DateTime): DateTime

Returns a new DateTime value that changes the Time value in the input to the beginning of the specified day.

The hours, minutes, and seconds in the input change to 00:00:00.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

dateTime

The DateTime value to reference.

Example

This example changes the Time value within the DateTime input to the beginning of the specified day.

Source

%dw 2.0
import * from dw::core::Dates
output application/json
---
{
  "atBeginningOfDayDateTime": atBeginningOfDay(|2020-10-06T18:23:20.351-03:00|)
}

Output

{
  "atBeginningOfDayDateTime": "2020-10-06T00:00:00-03:00"
}

atBeginningOfDay(localDateTime: LocalDateTime): LocalDateTime

Returns a new LocalDateTime value that changes the Time value within the input to the start of the specified day.

The hours, minutes, and seconds in the input change to 00:00:00.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

localDateTime

The LocalDateTime value to reference.

Example

This example changes the Time value within the LocalDateTime input to the beginning of the specified day.

Source

%dw 2.0
import * from dw::core::Dates
output application/json
---
{
  "atBeginningOfDayLocalDateTime": atBeginningOfDay(|2020-10-06T18:23:20.351|)
}

Output

{
  "atBeginningOfDayLocalDateTime": "2020-10-06T00:00:00"
}

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub