The DateTime
value to reference.
atBeginningOfYear
atBeginningOfYear(dateTime: DateTime): DateTime
Takes a DateTime
value as input and returns a DateTime
value for
the first day of the year specified in the input. It also sets the Time
value to 00:00:00
.
The month, day, and time in the input changes to 01-01T00:00:00
.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
Example
This example transforms the DateTime
input (|2020-10-06T18:23:20.351-03:00|
)
to the date of the first day of the Year
value (2020
) in the input.
Source
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
atBeginningOfYearDateTime: atBeginningOfYear(|2020-10-06T18:23:20.351-03:00|)
}
DataWeave
Output
{
"atBeginningOfYearDateTime": "2020-01-01T00:00:00.000-03:00"
}
Json
atBeginningOfYear(localDateTime: LocalDateTime): LocalDateTime
Takes a LocalDateTime
value as input and returns a LocalDateTime
value for
the first day of the year specified in the input. It also sets the Time
value to 00:00:00
.
The month, day, and time in the input changes to 01-01T00:00:00
.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
The |
Example
This example transforms the LocalDateTime
input (|2020-10-06T18:23:20.351|
)
to the date of the first day of the Year
value (2020
) in the input.
Source
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
atBeginningOfYearLocalDateTime: atBeginningOfYear(|2020-10-06T18:23:20.351|)
}
DataWeave
Output
{
"atBeginningOfYearLocalDateTime": "2020-01-01T00:00:00"
}
Json
atBeginningOfYear(date: Date): Date
Takes a Date
value as input and returns a Date
value for
the first day of the year specified in the input.
The month and day in the input changes to 01-01
.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
The |
Example
This example transforms Date
input (|2020-10-06|
) to the date of the
first day of the Year
value (2020
) in the input.
Source
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
atBeginningOfYearDate: atBeginningOfYear(|2020-10-06|)
}
DataWeave
Output
{
"atBeginningOfYearDate": "2020-01-01"
}
Json