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:storybook.ui.chart.jfreechart.ChartUtil.java

public static Marker getDateIntervalMarker(Date paramDate1, Date paramDate2, String paramString) {
    double d1 = paramDate1.getTime();
    double d2 = paramDate2.getTime();
    BasicStroke localBasicStroke = new BasicStroke(0.3F);
    IntervalMarker localIntervalMarker = new IntervalMarker(d1, d2, Color.pink, localBasicStroke, Color.black,
            localBasicStroke, 0.5F);/*from  w ww.ja va  2s .  c  o  m*/
    localIntervalMarker.setLabel(paramString);
    localIntervalMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
    localIntervalMarker.setLabelTextAnchor(TextAnchor.BOTTOM_CENTER);
    return localIntervalMarker;
}

From source file:ca.travelagency.utils.DateUtils.java

public static String formatDateAsMonth(Date date) {
    if (date == null) {
        return StringUtils.EMPTY;
    }//  ww w . ja  v a  2  s.c om
    return DateTimeFormat.forPattern(YEAR_MONTH_PATTERN).print(date.getTime());
}

From source file:com.bjond.utilities.DateTimeUtils.java

/**
 * Returns true if now greater than date
 *
 * @param date Valid non-null java.util.Date object
 * @return New date. Original is not altered.
 *//*from   w w w. j  a  v  a2  s.co m*/
public static boolean isNowAfter(final Date date) {
    return (date != null && System.currentTimeMillis() > date.getTime());
}

From source file:com.bjond.utilities.DateTimeUtils.java

/**
 * Returns true if NOW greater than or equal to date
 *
 * @param date Valid non-null java.util.Date object
 * @return New date. Original is not altered.
 *//*from ww  w  . j  ava2  s.  c o m*/
public static boolean isNowEqualToOrGreaterThan(final Date date) {
    return (date != null && System.currentTimeMillis() >= date.getTime());
}

From source file:net.duckling.ddl.util.Utility.java

public static Timestamp date2Timestamp(Date date) {
    if (date == null) {
        return null;
    } else {//  w w w.ja v  a 2s  .c  o  m
        return new Timestamp(date.getTime());
    }
}

From source file:storybook.ui.chart.jfreechart.ChartUtil.java

public static Marker getDateMarker(Date paramDate, String paramString, boolean paramBoolean) {
    double d = paramDate.getTime();
    ValueMarker localValueMarker = new ValueMarker(d, Color.red, new BasicStroke(0.3F));
    localValueMarker.setLabel(paramString);
    localValueMarker.setLabelFont(new Font("SansSerif", 2, 11));
    localValueMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
    if (paramBoolean) {
        localValueMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
    } else {/*from  w  ww . j a v  a  2s.  co m*/
        localValueMarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
    }
    return localValueMarker;
}

From source file:io.seldon.spark.actions.JobUtils.java

public static long utc_to_unixts(String utc_date) throws ParseException {
    DateFormat utcFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    utcFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

    Date date = utcFormat.parse(utc_date);
    return (date.getTime() / 1000);
}

From source file:ch.systemsx.cisd.openbis.generic.shared.dto.TimeInterval.java

/**
 * Whether given <var>olderDate</var> is before or equal to given <var>youngerDate</var>.
 * <p>/*from   w  w  w. j av  a  2 s  .c o  m*/
 * Returns <code>true</code> if one of given arguments is <code>null</code>.
 * </p>
 */
private final static boolean isBeforeOrEqual(final Date olderDate, final Date youngerDate) {
    return olderDate == null || youngerDate == null || olderDate.getTime() <= youngerDate.getTime();
}

From source file:com.thoughtworks.go.util.TimeReportingUtil.java

public static void print(TestAction testAction) throws Exception {
    Date begin;// w  w  w.j a  v a  2  s . com
    Date end;
    begin = new Date();
    testAction.perform();
    end = new Date();
    System.out.println("Time Taken: " + (end.getTime() - begin.getTime()) / 1000.0 + "s");
}

From source file:mitm.common.util.DateTimeUtils.java

public static Date addMilliseconds(Date date, long milliseconds) {
    Check.notNull(date, "date");

    return new Date(date.getTime() + milliseconds);
}