Example usage for org.joda.time DateTime getSecondOfMinute

List of usage examples for org.joda.time DateTime getSecondOfMinute

Introduction

In this page you can find the example usage for org.joda.time DateTime getSecondOfMinute.

Prototype

public int getSecondOfMinute() 

Source Link

Document

Get the second of minute field value.

Usage

From source file:li.klass.fhem.domain.AtDevice.java

License:Open Source License

private void parseDateContent(String dateContent) {
    if (dateContent.length() < "00:00:00".length()) {
        dateContent += ":00";
    }/*from w  w  w  .  j a  v a 2 s. c  o m*/
    try {
        DateTime date = DATE_TIME_FORMAT.parseDateTime(dateContent);
        hours = date.getHourOfDay();
        minutes = date.getMinuteOfHour();
        seconds = date.getSecondOfMinute();

    } catch (Exception e) {
        Log.e(AtDevice.class.getName(), "cannot parse dateContent " + dateContent);
    }
}

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()+//from ww  w  .jav a  2 s. 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: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  v a2s .  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

/**
 * /*from  ww  w .ja  v  a  2s. 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.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setStartOfProposalPeriodDateTime(final DateTime dateTime) {
    setStartOfProposalPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setStartOfProposalPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}

From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setEndOfProposalPeriodDateTime(final DateTime dateTime) {
    setEndOfProposalPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setEndOfProposalPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}

From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setStartOfCandidacyPeriodDateTime(final DateTime dateTime) {
    setStartOfCandidacyPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setStartOfCandidacyPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}

From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setEndOfCandidacyPeriodDateTime(final DateTime dateTime) {
    setEndOfCandidacyPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setEndOfCandidacyPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}

From source file:net.sourceforge.fenixedu.domain.onlineTests.StudentTestLog.java

License:Open Source License

public static String getChecksum(DistributedTest distributedTest, Registration student, DateTime dateTime) {
    StringBuilder checksumCode = new StringBuilder();
    checksumCode.append(student.getNumber());
    checksumCode.append(distributedTest.getExternalId());
    final DateTime thisDateTime = new DateTime(dateTime.getYear(), dateTime.getMonthOfYear(),
            dateTime.getDayOfMonth(), dateTime.getHourOfDay(), dateTime.getMinuteOfHour(),
            dateTime.getSecondOfMinute(), 0);
    checksumCode.append(thisDateTime.getMillis());
    checksumCode.append(Bennu.getInstance().getTestChecksumsSet().iterator().next().getChecksumCode());
    return (Hashing.sha1().hashString(checksumCode.toString(), Charsets.UTF_8)).toString();
}