Rectangle 27 0

The aui:input taglib (which in turn uses the liferay-ui:input-date and liferay-ui:input-time taglibs) shows the AM/PM select box if the time format for the current locale requires it. In Liferay 6.1.1, have a look at row 36 in html/taglib/ui/input_time/page.jsp.

So you should definitely keep the built-in behavior, which shows the AM/PM select box depending on the current locale.

In order to get the date properly in your portlet class, you can draw inspiration from the EditEventAction class, which is the Struts action called when you add, update or delete an event in the Calendar portlet. Something like this:

int startDateMonth = ParamUtil.getInteger(actionRequest, "startDateMonth");
int startDateDay = ParamUtil.getInteger(actionRequest, "startDateDay");
int startDateYear = ParamUtil.getInteger(actionRequest, "startDateYear");
int startDateHour = ParamUtil.getInteger(actionRequest, "startDateHour");
int startDateMinute = ParamUtil.getInteger(actionRequest, "startDateMinute");
int startDateAmPm = ParamUtil.getInteger(actionRequest, "startDateAmPm");

if (startDateAmPm == Calendar.PM) {
    startDateHour += 12;
}

After that, if you want to get a Date object from these values, it's important to decide whether these values represent a date in UTC, in the current user's timezone or whatever. Have a look at the addEvent method in CalEventLocalServiceImpl class to know how to do it: basically, you have to create a Calendar object with the CalendarFactoryUtil.getCalendar method, passing a locale and a timezone, and then you can set the various values.

java - Alloy UI time format 24 hours Liferay 6 - Stack Overflow

java liferay alloy-ui
Rectangle 27 0

Liferay UI part is poorly documented, here is the attributes I found, http://docs.liferay.com/portal/6.2/taglibs/liferay-ui/input-time.html, but it never describe how to use these attributes, what are the values of these attributes.

I wasted too much time on googling and experimenting, and I decided to use JQuery datetime pick instead.

java - Alloy UI time format 24 hours Liferay 6 - Stack Overflow

java liferay alloy-ui