Here you can find the source of getSecondOfDate(Date date)
public final static int getSecondOfDate(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public final static int getSecondOfDate(Date date) { return getFieldValueByDate(date, Calendar.SECOND); }/* w ww .ja va 2s.c o m*/ /** * get field value by date and the field, like get the year of a date * * @param date * @param field * @return */ public final static int getFieldValueByDate(Date date, int field) { Calendar c = Calendar.getInstance(); c.setTime(date); return c.get(field); } }