Here you can find the source of getSecondsSinceMidnight(final Calendar time)
public static int getSecondsSinceMidnight(final Calendar time)
//package com.java2s; // Licensed under the MIT license. See License.txt in the repository root. import java.util.Calendar; public class Main { /**//from w ww .j av a2 s . c o m * @return the number of seconds since midnight, as calculated by the * {@link Calendar#HOUR_OF_DAY}, {@link Calendar#MINUTE} and * {@link Calendar#SECOND} fields in the passed {@link Calendar}. */ public static int getSecondsSinceMidnight(final Calendar time) { return time.get(Calendar.SECOND) + (time.get(Calendar.MINUTE) * 60) + (time.get(Calendar.HOUR_OF_DAY) * 3600); } }