Example usage for java.util Calendar getTimeInMillis

List of usage examples for java.util Calendar getTimeInMillis

Introduction

In this page you can find the example usage for java.util Calendar getTimeInMillis.

Prototype

public long getTimeInMillis() 

Source Link

Document

Returns this Calendar's time value in milliseconds.

Usage

From source file:eu.planets_project.tb.impl.model.PropertyEvaluationRecordImpl.java

public PropertyRunEvaluationRecordImpl getPropertyRunEvalRecord(Calendar runDate) {
    if ((propertyRunEvalRecords == null) && (propertyRunEvalRecords.containsKey(runDate.getTimeInMillis()))) {
        return propertyRunEvalRecords.get(runDate.getTimeInMillis());
    }// www. j  ava  2 s . co  m
    return null;
}

From source file:io.gatling.jenkins.targetenvgraphs.BuildInfoForTargetEnvGraph.java

public Calendar getGraphEndTime() {
    Calendar endTime = (Calendar) this.getBuildStartTime().clone();
    endTime.setTimeInMillis(endTime.getTimeInMillis() + this.getBuildDuration());
    endTime.add(Calendar.MINUTE, BuildInfoForTargetEnvGraph.GRAPH_END_BUFFER_TIME_IN_MINUTES);

    return endTime;
}

From source file:adalid.commons.util.TimeUtils.java

public static Date addDate(java.util.Date date, int addend, char unit) {
    if (date == null) {
        return null;
    }/*  w w w.j a va2 s  .c o m*/
    Calendar c = newDateCalendar(date);
    if (addend != 0) {
        switch (unit) {
        case 'Y':
            c.add(Calendar.YEAR, addend);
            break;
        case 'M':
            c.add(Calendar.MONTH, addend);
            break;
        case 'D':
            c.add(Calendar.DAY_OF_MONTH, addend);
            break;
        default:
            break;
        }
    }
    return new Date(c.getTimeInMillis());
}

From source file:com.github.jrrdev.mantisbtsync.core.jobs.issues.writers.BugHistoryWriterTest.java

/**
 * Build the items to write./*w ww. j a  v a 2  s  .  com*/
 *
 * @return items
 */
private List<BugBean> buildItems() {

    final Calendar cal = Calendar.getInstance();
    final Timestamp date = new Timestamp(cal.getTimeInMillis());
    final List<BugBean> items = new ArrayList<BugBean>();

    final BugBean item1 = new BugBean();
    final BugHistoryBean hist = new BugHistoryBean();
    hist.setBugId(BigInteger.ONE);
    hist.setUserId(BigInteger.ONE);
    hist.setOldValue("old");
    hist.setNewValue("new");
    hist.setHistoryType(BigInteger.TEN);
    hist.setDateModified(date);

    item1.getHistory().add(hist);
    items.add(item1);

    return items;
}

From source file:com.github.jrrdev.mantisbtsync.core.jobs.issues.writers.BugNotesWriterTest.java

/**
 * Build the items to write.//from  w  w w .ja  va  2 s  .  c om
 *
 * @return items
 */
private List<BugBean> buildItems() {

    final Calendar cal = Calendar.getInstance();
    final Timestamp date = new Timestamp(cal.getTimeInMillis());
    final List<BugBean> items = new ArrayList<BugBean>();

    final BugBean item1 = new BugBean();
    final BugNoteBean note = new BugNoteBean();
    note.setId(BigInteger.ONE);
    note.setBugId(BigInteger.ONE);
    note.setReporterId(BigInteger.ONE);
    note.setTextNote("note_1");
    note.setDateSubmitted(date);
    note.setLastModified(date);

    item1.getNotes().add(note);
    items.add(item1);

    return items;
}

From source file:org.obiba.onyx.jade.instrument.holologic.APEXScanDataExtractor.java

/**
 * Called by computeTZScore().//w ww  .  j av a  2s .c o m
 *
 * @param s1
 * @param s2
 * @return
 * @throws ParseException
 */
public static Double computeYearsDifference(String s1, String s2) throws ParseException {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    Date d1;
    try {
        d1 = format.parse(s1);
    } catch (ParseException e) {
        throw e;
    }
    Date d2;
    try {
        d2 = format.parse(s2);
    } catch (ParseException e) {
        throw e;
    }

    Calendar c1 = Calendar.getInstance();
    c1.setTime(d1);
    Calendar c2 = Calendar.getInstance();
    c2.setTime(d2);

    Double diff = (c1.getTimeInMillis() - c2.getTimeInMillis()) / (1000. * 60. * 60. * 24. * 365.25);
    if (diff < 0.)
        diff *= -1.;

    return diff;
}

From source file:hudson.util.Graph.java

protected Graph(Calendar timestamp, int defaultW, int defaultH) {
    this(timestamp.getTimeInMillis(), defaultW, defaultH);
}

From source file:de.interseroh.report.domain.visitors.RequestParamsBuilderTest.java

private Date fixedDate() {
    Calendar calendar = Calendar.getInstance(Locale.GERMANY);
    calendar.set(2015, 8, 5, 21, 12, 23);
    return new Date(calendar.getTimeInMillis());
}

From source file:it.geosolutions.opensdi2.session.impl.UserSessionImpl.java

public void setExpiration(Calendar expiration) {
    this.expiration = expiration;
    if (expiration != null) {
        expirationInterval = expiration.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
    }/*from w w w .j  av a  2 s .  c  om*/
}

From source file:org.openmeetings.test.calendar.TestAppointmentAddAppointment.java

@Test
public void saveAppointment() {
    log.debug("- 1 MeetingReminderJob.execute");
    log.warn("- 2 MeetingReminderJob.execute");

    try {//w  w w.  java 2 s  .  c  o  m

        //Simulate webapp path
        //ScopeApplicationAdapter.webAppPath = "./WebContent";

        Calendar start = Calendar.getInstance();
        start.setTimeInMillis(start.getTimeInMillis() + 600000);

        Calendar end = Calendar.getInstance();
        end.setTimeInMillis(start.getTimeInMillis() + 600000);

        String appointmentName = "Test 01";
        String appointmentDescription = "Descr";
        Long users_id = 1L;
        String appointmentLocation = "office";
        Boolean isMonthly = false;
        Date appointmentstart = start.getTime();
        Date appointmentend = end.getTime();
        Boolean isDaily = false;
        Long categoryId = 1L;
        Boolean isWeekly = false;
        Long remind = 3L;
        Boolean isYearly = false;
        List<Map<String, String>> mmClient = new LinkedList<Map<String, String>>();
        for (int i = 0; i < 1; i++) {
            mmClient.add(createClientObj("firstname" + i, "lastname" + i,
                    "first" + i + ".last" + i + "@webbase-design.de", "Etc/GMT+1"));
        }
        Long language_id = 1L;
        String baseUrl = "http://localhost:5080/openmeetings/";
        Long roomType = 1L;

        Long id = appointmentLogic.saveAppointment(appointmentName, users_id, appointmentLocation,
                appointmentDescription, appointmentstart, appointmentend, isDaily, isWeekly, isMonthly,
                isYearly, categoryId, remind, mmClient, roomType, baseUrl, language_id, false, "");

        Thread.sleep(3000);

        appointmentLogic.doScheduledMeetingReminder();

        Thread.sleep(3000);

        assertTrue("Saved appointment should have valid id: " + id, id != null && id > 0);

    } catch (Exception err) {
        log.error("[saveAppointment]", err);
    }
}