set Next Round Minute - Java java.util

Java examples for java.util:Minute

Description

set Next Round Minute

Demo Code

/**//from w  ww  . j a v  a  2 s .  co  m
 * This file is part of JEMMA - http://jemma.energy-home.org
 * (C) Copyright 2013 Telecom Italia (http://www.telecomitalia.it)
 *
 * JEMMA is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License (LGPL) version 3
 * or later as published by the Free Software Foundation, which accompanies
 * this distribution and is available at http://www.gnu.org/licenses/lgpl.html
 *
 * JEMMA is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License (LGPL) for more details.
 *
 */
//package com.java2s;

import java.util.Calendar;

public class Main {
    public static void main(String[] argv) throws Exception {
        Calendar c = Calendar.getInstance();
        setNextRoundMinute(c);
    }

    public static void setNextRoundMinute(Calendar c) {
        // add a minute from now
        c.add(Calendar.MINUTE, 1);
        // reset all other fields fraction of the minute
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
    }
}

Related Tutorials