Here you can find the source of addOrRemoveMinutes(String set, int minutesBeforeSunset)
public static String addOrRemoveMinutes(String set, int minutesBeforeSunset) throws ParseException
//package com.java2s; /*/* w w w .ja v a 2 s . c o m*/ * This file is subject to the terms and conditions defined in * file 'LICENSE.txt', which is part of this source code package. */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String addOrRemoveMinutes(String set, int minutesBeforeSunset) throws ParseException { SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); Date d = df.parse(set); Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.MINUTE, minutesBeforeSunset); return df.format(cal.getTime()); } }