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

Android examples for java.util:Time

Description

get Default 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 getDefaultSilenceTime() {
        Calendar calendar = Calendar.getInstance();

        calendar.setTime(new Date());

        calendar.add(Calendar.MINUTE, 120);

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

        return format.format(calendar.getTime());
    }/*from  www  . j  a  v  a 2  s. c o  m*/
}

Related Tutorials