Java Milliseconds millisecond(final Date date)

Here you can find the source of millisecond(final Date date)

Description

millisecond

License

Apache License

Declaration

public static int millisecond(final Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import static java.util.Calendar.*;

public class Main {
    public static int millisecond(final Date date) {
        return fromDateToCalendar(date).get(MILLISECOND);
    }/*  w w  w.  j a  v  a 2 s  .  c  o m*/

    public static Calendar fromDateToCalendar(final Date date) {
        final Calendar cal = new GregorianCalendar();
        cal.clear();
        cal.setMinimalDaysInFirstWeek(4);
        cal.setFirstDayOfWeek(Calendar.MONDAY);
        cal.setTime(date);

        return cal;
    }
}

Related

  1. megaCyclesToMilliseconds(long megaCycles)
  2. microsToMillis(long micros)
  3. microsToMillis(long sec, long usec)
  4. milliDate(String date)
  5. millisBetween(Date firstDate, Date lastDate)
  6. millisecondOf(Date date)
  7. milliseconds(int offset)
  8. millisecondsBetween(Date start, Date finish)
  9. millisecondsSinceMidnight(Date date)