Java Date to Time getTimeFromDate(Date date)

Here you can find the source of getTimeFromDate(Date date)

Description

get Time From Date

License

Creative Commons License

Declaration

public static long getTimeFromDate(Date date) 

Method Source Code


//package com.java2s;
//License from project: Creative Commons License 

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

public class Main {
    public static final long MILLIS_PER_DAY = (24 * 60 * 60 * 1000);

    public static long getTimeFromDate(Date date) {
        Date now = Calendar.getInstance().getTime();
        long timePortion = now.getTime() % MILLIS_PER_DAY;

        return timePortion;
    }//from ww w  . j ava2 s  . c  o m
}

Related

  1. getTimeByCustomPattern(Date date, String pattern)
  2. getTimeByOffset(Date reqDate, int offset)
  3. getTimeDateByMinuteAndSeconds( Integer minutes, Integer seconds)
  4. getTimeDateStr(Date date)
  5. getTimeDeltaValue(Date t, Date baseDate, String tDelta)
  6. getTimeFromDate(final Date date)
  7. getTimeImMillis(Date date)
  8. getTimeInSeconds(Date date)
  9. getTimeInterval(Date fromDate)