Here you can find the source of getTimeInSeconds(Date date)
Parameter | Description |
---|---|
date | the date |
public static int getTimeInSeconds(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**/*from ww w .j a v a 2 s . com*/ * Gets time in seconds. E.g. 600 for 00:10. * @param date the date * @return time in seconds */ public static int getTimeInSeconds(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.HOUR_OF_DAY) * 60 * 60 + calendar.get(Calendar.MINUTE) * 60 + calendar.get(Calendar.SECOND); } }