java - Alloy UI time format 24 hours Liferay 6 -
hi there how show allow ui date picker time field using 24 hours format? i'f i'm using
[code] <% calendar dob = calendarfactoryutil.getcalendar(); dob.settime(new date()); %> <aui:input name="schedule_msg" model="<%= message_schedule.class %>" bean="<%= msch %>" value="<%= %>" label="schedule time"/> [/code]
it shows in am/pm mode...or if using am/pm mode how value??normally if want value in portlet class [code]
int day = paramutil.getinteger(request, "schedule_msgday"); int month = paramutil.getinteger(request, "schedule_msgmonth"); int year = paramutil.getinteger(request, "schedule_msgyear"); int hour = paramutil.getinteger(request, "schedule_msghour"); int min = paramutil.getinteger(request, "schedule_msgminute"); try { msgschedule.setschedule_msg(portalutil.getdate(month, day, year, hour, min, new portalexception())); }catch(exception e) { msgschedule.setschedule_msg(new date()); }
[/code] idea how value?? example in picture show 4:54: pm means in 24 hours become 16:54:00 .... please
thank's
regards
danial
the aui:input
taglib (which in turn uses liferay-ui:input-date
, liferay-ui:input-time
taglibs) shows am/pm select box if time format current locale requires it. in liferay 6.1.1, have @ row 36 in html/taglib/ui/input_time/page.jsp
.
so should keep built-in behavior, shows am/pm select box depending on current locale.
in order date in portlet class, can draw inspiration editeventaction
class, struts action called when add, update or delete event in calendar portlet. 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 want date
object these values, it's important decide whether these values represent date in utc, in current user's timezone or whatever. have @ addevent
method in caleventlocalserviceimpl
class know how it: basically, have create calendar object calendarfactoryutil.getcalendar
method, passing locale , timezone, , can set various values.
Comments
Post a Comment