Java Second Calculate getSecond(long t)

Here you can find the source of getSecond(long t)

Description

get Second

License

LGPL

Declaration

public static int getSecond(long t) 

Method Source Code

//package com.java2s;
/**/*from   w  ww . j a  v a 2  s  . c  o  m*/
 * Converts a line of text into an array of lower case words using a
 * BreakIterator.wordInstance(). <p>
 *
 * This method is under the Jive Open Source Software License and was
 * written by Mark Imbriaco.
 *
 * @param text a String of text to convert into an array of words
 * @return text broken up into an array of words.
 */

import java.util.Calendar;

import java.util.Date;

public class Main {
    public static int getSecond(long t) {
        Calendar cld = Calendar.getInstance();
        if (t > 0) {
            cld.setTime(new java.util.Date(t));
        }
        return cld.get(Calendar.SECOND);
    }

    public static int getSecond(Date date) {
        Calendar cld = Calendar.getInstance();
        cld.setTime(date);
        return cld.get(Calendar.SECOND);
    }
}

Related

  1. computeStartOfNextSecond(long now)
  2. getMillisecond(long num, int unit)
  3. getSecond(String s)
  4. nextSecond(int second)
  5. secondsLater(Integer seconds)