List of usage examples for java.util Calendar getTimeInMillis
public long getTimeInMillis()
From source file:eu.europa.ec.fisheries.uvms.plugins.inmarsat.twostage.Connect.java
private String getFileName(String path) { Calendar cal = Calendar.getInstance(); return path + cal.getTimeInMillis() + ".dat"; }
From source file:com.mirth.connect.client.ui.StatusBar.java
public void setServerTime(Calendar serverTime) { timeOffset = serverTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(); serverTimeZone = serverTime.getTimeZone().getID(); localTimeZone = Calendar.getInstance().getTimeZone().getID(); new Thread() { @Override/*from w w w .j ava2 s . c o m*/ public void run() { while (!Thread.currentThread().isInterrupted()) { try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { timezoneLabel.setText(convertLocalToServerTime() + " " + timezoneText); } }); Thread.sleep(30000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (InvocationTargetException e) { } } } }.start(); }
From source file:javasnack.cli.CliDbUnitCsvExportDemo.java
void setup(Connection conn) throws Exception { new T1().setup(conn); Calendar c = Calendar.getInstance(); c.clear();/*from w w w . j a v a2s . c o m*/ c.set(2000, 11, 31, 23, 59, 59); long insertTIM = c.getTimeInMillis(); new T1(true, 10, new BigDecimal(20), 30.0, new Time(insertTIM), new Date(insertTIM), new Timestamp(insertTIM), "'Hello', \"World\"!").insertMe(conn); c.clear(); c.set(2001, 0, 1, 12, 30, 15); insertTIM = c.getTimeInMillis(); new T1(false, 20, new BigDecimal(30), 40.0, new Time(insertTIM), new Date(insertTIM), new Timestamp(insertTIM), "'Hello', \n\"World\"!").insertMe(conn); new T2().setup(conn); new T2(UnsignedByte.create0x00to0xFFString(), UnsignedByte.create0x00to0xFF(), UnsignedByte.create0x00to0xFF()).insertMe(conn); }
From source file:com.comcast.cats.monitor.reboot.BarcelonaRebootMonitor.java
/** * Calculate time interval between SNMP queries. * // www .j a v a 2s .co m * @return time difference in millis */ private long calculcateMonitorTimeIntervalInMillis() { Calendar currentTime = Calendar.getInstance(); Calendar lastMonitoredTime = (Calendar) getState(); return currentTime.getTimeInMillis() - lastMonitoredTime.getTimeInMillis(); }
From source file:com.mgmtp.jfunk.common.random.MathRandom.java
/** * Returns a random Calendar object in the range of [min, max]. * /*from w w w .j av a 2 s .co m*/ * @param min * minimum value for generated Calendar object * @param max * maximum value for generated Calendar object */ public Calendar getCalendar(final Calendar min, final Calendar max) { long millis = getLong(min.getTimeInMillis(), max.getTimeInMillis()); return createCalendar(millis); }
From source file:jp.co.opentone.bsol.linkbinder.view.servlet.WebResourceServlet.java
protected void setHeader(HttpServletResponse response, String path) { response.setDateHeader("Last-Modified", System.currentTimeMillis()); Calendar expires = Calendar.getInstance(); expires.add(Calendar.DAY_OF_YEAR, 7); response.setDateHeader("Expires", expires.getTimeInMillis()); //12 hours: 43200 = 60s * 60 * 12 response.setHeader("Cache-Control", "max-age=43200"); response.setHeader("Pragma", ""); String contentType = getContentType(path); if (StringUtils.isNotEmpty(contentType)) { response.setContentType(contentType); }//from w ww . java 2 s.c o m }
From source file:com.eryansky.common.utils.DateUtil.java
/** * ??// w ww.j a va 2s. c o m */ public static long addMinutes(long longCalendar, int intMin) { try { // long longDate = 0; Calendar cal = getCalendar(longCalendar); long longMills = cal.getTimeInMillis() + intMin * 60 * 1000; cal.setTimeInMillis(longMills); if (String.valueOf(longCalendar).length() < 14) longDate = getLongCalendar(cal); else longDate = getLongTime(cal); // return longDate; } catch (Exception Exp) { return -1; } }
From source file:com.eryansky.common.utils.DateUtil.java
/** * ???//from w w w . ja va 2s . c om */ public static long addHours(long longCalendar, int intHour) { try { // long longDate = 0; Calendar cal = getCalendar(longCalendar); long longMills = cal.getTimeInMillis() + intHour * 60 * 60 * 1000; cal.setTimeInMillis(longMills); if (String.valueOf(longCalendar).length() < 14) longDate = getLongCalendar(cal); else longDate = getLongTime(cal); // return longDate; } catch (Exception Exp) { return -1; } }
From source file:com.eryansky.common.utils.DateUtil.java
/** * ??//from w ww .j ava 2 s . co m */ public static long addDays(long longCalendar, int intDay) { try { // long longDate = 0; Calendar cal = getCalendar(longCalendar); long longMills = cal.getTimeInMillis() + intDay * 24 * 60 * 60 * 1000; cal.setTimeInMillis(longMills); if (String.valueOf(longCalendar).length() < 14) longDate = getLongCalendar(cal); else longDate = getLongTime(cal); // return longDate; } catch (Exception Exp) { return -1; } }
From source file:com.eryansky.common.utils.DateUtil.java
/** * ??/*from w w w .ja va 2 s.c o m*/ */ public static long addWeeks(long longCalendar, int intWeek) { try { // long longDate = 0; Calendar cal = getCalendar(longCalendar); long longMills = cal.getTimeInMillis() + intWeek * 7 * 24 * 60 * 60 * 1000; cal.setTimeInMillis(longMills); if (String.valueOf(longCalendar).length() < 14) longDate = getLongCalendar(cal); else longDate = getLongTime(cal); // return longDate; } catch (Exception Exp) { return -1; } }