Example usage for java.util Date getTime

List of usage examples for java.util Date getTime

Introduction

In this page you can find the example usage for java.util Date getTime.

Prototype

public long getTime() 

Source Link

Document

Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.

Usage

From source file:Main.java

public static String timestamp() {
    Date date = new Date();
    long time = date.getTime();
    return "" + time;
}

From source file:Main.java

public static int betweenSec(Date from, Date to) {
    long duration = from.getTime() - to.getTime();
    return (int) (duration / (1000));
}

From source file:Main.java

public static long DateToDtnShortDate(Date normalDate) {
    return normalDate.getTime() / 1000 - DTNEPOCH;
}

From source file:Main.java

public static int get_between_days(Date date1, Date date2) {
    return (int) ((date1.getTime() - date2.getTime()) / (24 * 60 * 60 * 1000));
}

From source file:Main.java

/**
 * Returns the number of days since 01/01/1970. The value is rounded off to
 * the floor value and does not take daylight saving time into account.
 *
 * @param date the date.//from   w  w w.  j av a 2 s .  c  o  m
 * @return number of days since Epoch.
 */
public static long getDays(Date date) {
    return date.getTime() / MS_PER_DAY;
}

From source file:Main.java

/**
 * @return Return current day timestamp with YY, MM, dd info ONLY
 *//*ww  w  . j ava  2  s.c  om*/
public static Long getCurrentDateLong() {
    Date date = new Date();
    long ss = date.getTime();
    return ss;
}

From source file:Main.java

private static long makeDelay(double mins) {
    Date dateNow = new Date();
    return (long) (dateNow.getTime() + (mins) * 60 * 1000);
}

From source file:Main.java

public static long GetCurrentDateForTimeMills() {
    Date date = new Date();
    long mills = date.getTime();
    date = null;/* w ww  .  ja v  a 2  s . c o  m*/
    return mills;
}

From source file:Main.java

public static long subtractDate(Date dateStart, Date dateEnd) {
    return dateEnd.getTime() - dateStart.getTime();
}

From source file:Main.java

public static String getTimeString() {
    Date d = new Date();
    return String.valueOf(d.getTime());
}