Contact Us 1-800-596-4880

atBeginningOfMonth

atBeginningOfMonth(dateTime: DateTime): DateTime

Returns a new DateTime value that changes the Day value from the input to the first day of the specified month. It also sets the Time value to 00:00:00.

The day and time in the input changes to 01T00:00:00.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

dateTime

The DateTime value to reference.

Example

This example changes the Day value within the DateTime input to the first day of the specified month and sets the Time value to 00:00:00.

Source

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

Output

{
  "atBeginningOfMonthDateTime": "2020-10-01T00:00:00-03:00"
}

atBeginningOfMonth(localDateTime: LocalDateTime): LocalDateTime

Returns a new LocalDateTime value that changes the Day and LocalTime values from the input to the beginning of the specified month.

The day and time in the input changes to 01T00:00:00.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

localDateTime

The LocalDateTime value to reference.

Example

This example changes the Day and LocalTime values within the LocalDateTime input to the beginning of the specified month.

Source

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

Output

{
  "atBeginningOfMonthLocalDateTime": "2020-10-01T00:00:00"
}

atBeginningOfMonth(date: Date): Date

Returns a new Date value that changes the Day value from the input to the first day of the specified month.

The day in the input changes to 01.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

date

The Date value to reference.

Example

This example changes the Day value within the Date input to the first day of the specified month.

Source

%dw 2.0
import * from dw::core::Dates
output application/json
---
{
  atBeginningOfMonthDate: atBeginningOfMonth(|2020-10-06|)
}

Output

{
  "atBeginningOfMonthDate": "2020-10-01"
}