withHour12

Syntax

	$calendar.withHour12($hour)

Description

Creates a new calendar from the given calendar, setting the hour in 12-hour format to hour. Changing the hour can also change other values such as the hour (24-hour format).

Parameters

Name Type Description Mandatory Default
calendar Business object The calendar whose hour is to be changed. It can be a system or user calendar. yes
hour Number Value for the new hour to be set for the calendar. yes

Return value

Type: Business object

A calendar with the changed value for the hour.

Examples

hour <=12

	dateTime(2012, 8, 15, 7, 55, 24, 13).toUserCalendar().withHour12(2).hour12()

Output: 2

hour > 12

	dateTime(2012, 8, 15, 7, 55, 24, 13).toUserCalendar().withHour12(15).hour12()

Output: 3

The hour is converted to 12-hour format.

hour() to withHour12()

	dateTime(2012, 8, 15, 7, 55, 24, 13).toUserCalendar().withHour12(15).hour()

Output: 15

If you set a new value for hour12, hour is also changed.