List of usage examples for org.joda.time DateTime getMinuteOfHour
public int getMinuteOfHour()
From source file:loci.formats.in.MetamorphReader.java
License:Open Source License
/** Converts a time value in milliseconds into a human-readable string. */ public static String decodeTime(int millis) { DateTime tm = new DateTime(millis, DateTimeZone.UTC); String hours = intFormat(tm.getHourOfDay(), 2); String minutes = intFormat(tm.getMinuteOfHour(), 2); String seconds = intFormat(tm.getSecondOfMinute(), 2); String ms = intFormat(tm.getMillisOfSecond(), 3); return hours + ":" + minutes + ":" + seconds + ":" + ms; }
From source file:lucee.commons.date.JodaDateTimeUtil.java
License:Open Source License
@Override public String toString(lucee.runtime.type.dt.DateTime date, TimeZone tz) { //return jreUtil.toString(date, tz); /*DateTime dt = new DateTime(date.getTime(),getDateTimeZone(tz)); return "{ts '"+dt.getYear()+/*w w w .java2s . c om*/ "-"+dt.getMonthOfYear()+ "-"+dt.getDayOfMonth()+ " "+dt.getHourOfDay()+ ":"+dt.getMinuteOfHour()+ ":"+dt.getSecondOfMinute()+"'}";*/ StringBuilder sb = new StringBuilder(); DateTime dt = new DateTime(date.getTime(), getDateTimeZone(tz)); sb.append("{ts '"); jreUtil.toString(sb, dt.getYear(), 4); sb.append("-"); jreUtil.toString(sb, dt.getMonthOfYear(), 2); sb.append("-"); jreUtil.toString(sb, dt.getDayOfMonth(), 2); sb.append(" "); jreUtil.toString(sb, dt.getHourOfDay(), 2); sb.append(":"); jreUtil.toString(sb, dt.getMinuteOfHour(), 2); sb.append(":"); jreUtil.toString(sb, dt.getSecondOfMinute(), 2); sb.append("'}"); return sb.toString(); }
From source file:models.MailTransaction.java
License:Apache License
/** * @return the Timestamp as String in the Format "dd.MM.yyyy hh:mm" *///from w w w .j ava 2 s . c o m public String getTsAsString() { DateTime dt = new DateTime(this.ts); String day = ""; String mon = ""; String hou = ""; String min = ""; // add a leading "0" if the value is under ten if (dt.getDayOfMonth() < 10) { day += "0"; } day += String.valueOf(dt.getDayOfMonth()); if (dt.getMonthOfYear() < 10) { mon += "0"; } mon += String.valueOf(dt.getMonthOfYear()); if (dt.getHourOfDay() < 10) { hou += "0"; } hou += String.valueOf(dt.getHourOfDay()); if (dt.getMinuteOfHour() < 10) { min += "0"; } min += String.valueOf(dt.getMinuteOfHour()); return day + "." + mon + "." + dt.getYear() + " " + hou + ":" + min; }
From source file:models.MBox.java
License:Apache License
/** * @return the timestamp as string in the format "yyyy-MM-dd hh:mm" <br/> * if its 0, then also 0 is returned *//* w ww . ja v a2 s .c o m*/ @JsonIgnore public String getTSAsStringWithNull() { if (this.ts_Active == 0) { return "0"; } else if (this.ts_Active == -1) { return "-1"; } else { DateTime dt = new DateTime(this.ts_Active); StringBuilder timeString = new StringBuilder(); // add a leading "0" if the value is under ten timeString.append(dt.getYear()).append("-"); timeString.append(HelperUtils.addZero(dt.getMonthOfYear())); timeString.append("-"); timeString.append(HelperUtils.addZero(dt.getDayOfMonth())); timeString.append(" "); timeString.append(HelperUtils.addZero(dt.getHourOfDay())); timeString.append(":"); timeString.append(HelperUtils.addZero(dt.getMinuteOfHour())); return timeString.toString(); } }
From source file:nbm.center.catalog.CatalogXmlFactory.java
License:Apache License
private String makeCatalogTimestampFrom(DateTime today) { String catalogTimestamp = ""; catalogTimestamp += "00" + "/"; catalogTimestamp += today.getMinuteOfHour() + "/"; catalogTimestamp += today.getHourOfDay() + "/"; catalogTimestamp += today.getDayOfMonth() + "/"; catalogTimestamp += today.getMonthOfYear() + "/"; catalogTimestamp += today.getYear(); return catalogTimestamp; }
From source file:net.marfgamer.jraknet.RakNetLogger.java
License:Open Source License
/** * Logs a message if logging is enabled by the <code>RakNet</code> class and * the current level is greater than or equal to the current logging level. * /*from w ww . j a va 2 s . c o m*/ * @param level * the level of the log. * @param message * the message to log. */ private static final void log(int level, String message) { if (RakNet.isLoggingEnabled() && loggerLevel >= level && level < LEVEL_NAMES.length) { DateTime loggerDate = new DateTime(System.currentTimeMillis()); @SuppressWarnings("resource") // Closing the streams would break the // console PrintStream logStream = (level != LEVEL_ERROR ? System.out : System.err); logStream.println("[" + LOGGER_DATE_FORMAT.format(loggerDate.getHourOfDay()) + ":" + LOGGER_DATE_FORMAT.format(loggerDate.getMinuteOfHour()) + ":" + LOGGER_DATE_FORMAT.format(loggerDate.getSecondOfMinute()) + "] [" + LEVEL_NAMES[level].toUpperCase() + "]" + LEVEL_SPACERS[level] + " JRakNet " + message); } }
From source file:net.naijatek.myalumni.modules.admin.presentation.action.MaintainSystemModuleAction.java
License:Open Source License
/** * // w w w .j a v a 2 s. c o m * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward databaseBackup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (!adminSecurityCheck(request)) { return mapping.findForward(BaseConstants.FWD_ADMIN_LOGIN); } ActionMessages msgs = new ActionMessages(); DateTime dtime = new DateTime(new Date()); String dateStr = dtime.getMonthOfYear() + "_" + dtime.getDayOfMonth() + "_" + dtime.getYear() + "_" + dtime.getHourOfDay() + "_" + dtime.getMinuteOfHour() + "_" + dtime.getSecondOfMinute(); try { sysService.systemDatabaseBackup(getSysProp().getValue("BACKUP.FILEPATH") + dateStr + ".sql"); } catch (MyAlumniBaseException ex) { msgs.add(BaseConstants.ERROR_KEY, new ActionMessage(ex.getMessage())); saveMessages(request, msgs); return mapping.getInputForward(); } msgs.add(BaseConstants.INFO_KEY, new ActionMessage("message.backupsuccessful", dateStr + ".sql")); saveMessages(request, msgs); listDatabaseBackupHelper(request); return mapping.findForward(BaseConstants.FWD_SUCCESS); }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.person.vigilancy.CreateUnavailablePeriod.java
License:Open Source License
private static void sendEmail(Person person, DateTime begin, DateTime end, String justification, List<VigilantGroup> groups) { for (VigilantGroup group : groups) { String bccs = group.getContactEmail(); String beginDate = begin.getDayOfMonth() + "/" + begin.getMonthOfYear() + "/" + begin.getYear() + " - " + String.format("%02d", begin.getHourOfDay()) + ":" + String.format("%02d", begin.getMinuteOfHour()) + "h"; String endDate = end.getDayOfMonth() + "/" + end.getMonthOfYear() + "/" + end.getYear() + " - " + String.format("%02d", end.getHourOfDay()) + ":" + String.format("%02d", end.getMinuteOfHour()) + "h"; ;/* w w w . ja v a2 s .c o m*/ String message = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.unavailablePeriod", new String[] { person.getName(), beginDate, endDate, justification }); String subject = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.unavailablePeriod.subject", new String[] { group.getName() }); Sender sender = Bennu.getInstance().getSystemSender(); new Message(sender, new ConcreteReplyTo(group.getContactEmail()).asCollection(), Collections.EMPTY_LIST, subject, message, bccs); } }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.scientificCouncil.thesis.ApproveThesisProposal.java
License:Open Source License
private int hasTime(DateTime proposedDiscussed) { if (proposedDiscussed.getHourOfDay() == 0 && proposedDiscussed.getMinuteOfHour() == 0) { return 0; } else {//from w w w.ja v a 2 s . com return 1; } }
From source file:net.sourceforge.fenixedu.domain.EnrolmentEvaluation.java
License:Open Source License
@Override public void setExamDateYearMonthDay(YearMonthDay evaluationDateYearMonthDay) { if (evaluationDateYearMonthDay != null) { final Enrolment enrolment = getEnrolment(); final Thesis thesis = enrolment.getThesis(); if (thesis != null) { DateTime newDateTime = evaluationDateYearMonthDay.toDateTimeAtMidnight(); final DateTime dateTime = thesis.getDiscussed(); if (dateTime != null) { newDateTime = newDateTime.withHourOfDay(dateTime.getHourOfDay()); newDateTime = newDateTime.withMinuteOfHour(dateTime.getMinuteOfHour()); }/*from w w w.j a v a 2 s. co m*/ thesis.setDiscussed(newDateTime); } } super.setExamDateYearMonthDay(evaluationDateYearMonthDay); }