get Silence Time in yyyy:MM:dd HH:mm format - Android java.util

Android examples for java.util:Time

Description

get Silence Time in yyyy:MM:dd HH:mm format

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    public static String getSilenceTime(int minute) {
        Calendar calendar = Calendar.getInstance();

        calendar.setTime(new Date());

        calendar.add(Calendar.MINUTE, minute);

        SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd HH:mm");

        return format.format(calendar.getTime());

    }/*  w w w.j a  v  a2  s  .co  m*/
}

Related Tutorials