Here you can find the source of getTimeInDate(int offSetInMinutes)
public static String getTimeInDate(int offSetInMinutes)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String getTimeInDate(int offSetInMinutes) { DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date dNow = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(dNow);//from w w w . j a va 2 s . c om calendar.add(Calendar.MINUTE, offSetInMinutes); dNow = calendar.getTime(); return dateFormat.format(dNow); } }