Contact Us 1-800-596-4880

atBeginningOfHour

atBeginningOfHour(dateTime: DateTime): DateTime

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

The minutes and seconds in the input change to 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 hour.

Source

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

Output

{
 "atBeginningOfHourDateTime": "2020-10-06T18:00:00-03:00"
}

atBeginningOfHour(localDateTime: LocalDateTime): LocalDateTime

Returns a new LocalDateTime value that changes the Time value in the input to the beginning of the specified hour.

The minutes and seconds in the input change to 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 hour.

Source

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

Output

{
 "atBeginningOfHourLocalDateTime": "2020-10-06T18:00:00"
}

atBeginningOfHour(localTime: LocalTime): LocalTime

Returns a new LocalTime value that changes its value in the input to the beginning of the specified hour.

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

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

localTime

The LocalTime value to reference.

Example

This example changes the LocalTime value to the beginning of the specified hour.

Source

%dw 2.0
import * from dw::core::Dates
output application/json
---
{
   "atBeginningOfHourLocalTime": atBeginningOfHour(|18:23:20.351|)
}

Output

{
 "atBeginningOfHourLocalTime": "18:00:00"
}

atBeginningOfHour(time: Time): Time

Returns a new Time value that changes the input value to the beginning of the specified hour.

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

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

time

The Time value to reference.

Example

This example changes the Time value to the beginning of the specified hour.

Source

%dw 2.0
import * from dw::core::Dates
output application/json
---
{
   "atBeginningOfHourTime": atBeginningOfHour(|18:23:20.351-03:00|)
}

Output

{
 "atBeginningOfHourTime":  "18:00:00-03:00"
}