Java Date to Second getSeconds(Date dt)

Here you can find the source of getSeconds(Date dt)

Description

Returns Seconds of the date

License

Open Source License

Parameter

Parameter Description
dt The given Date

Return

int

Declaration

public static int getSeconds(Date dt) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;

public class Main {
    /**/*www  .  ja va  2 s  .c om*/
     * Returns Seconds of the date
     * 
     * @param dt
     *            The given Date
     * @return int
     */
    public static int getSeconds(Date dt) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(dt);
        return cal.get(Calendar.SECOND);
    }
}

Related

  1. getSecond(Date date)
  2. getSecond(java.util.Date date)
  3. getSecondOfDate(Date date)
  4. getSecondOfMinute(final Date date)
  5. getSeconds(Date d)
  6. getSecondsFromDate(Date date)