List of usage examples for java.sql Timestamp getTime
public long getTime()
From source file:jp.co.ctc_g.jfw.core.util.Dates.java
/** * ??????????./* www. j av a 2s.c o m*/ * @param date1 ? * @param date2 ? * @return ??? */ public static long difference(Timestamp date1, Timestamp date2) { return date2.getTime() - date1.getTime(); }
From source file:monasca.api.infrastructure.persistence.vertica.StatisticVerticaRepoImpl.java
private List<Object> parseRow(Map<String, Object> row) { List<Object> statisticsRow = new ArrayList<>(); Double sum = (Double) row.get("sum"); Double average = (Double) row.get("avg"); Double min = (Double) row.get("min"); Double max = (Double) row.get("max"); Long count = (Long) row.get("count"); Timestamp time_stamp = (Timestamp) row.get("time_interval"); if (time_stamp != null) { statisticsRow.add(DATETIME_FORMATTER.print(time_stamp.getTime())); }//from w w w.ja v a2 s . com if (average != null) { statisticsRow.add(average); } if (count != null) { statisticsRow.add(count); } if (max != null) { statisticsRow.add(max); } if (min != null) { statisticsRow.add(min); } if (sum != null) { statisticsRow.add(sum); } return statisticsRow; }
From source file:org.kuali.kfs.module.ar.document.service.impl.ContractsGrantsBillingAwardVerificationServiceImpl.java
/** * @see org.kuali.kfs.module.ar.document.service.ContractsGrantsInvoiceDocumentService#hasNoMilestonesToInvoice(org.kuali.kfs.integration.cg.ContractsAndGrantsBillingAward) *///from w ww .j av a2s . c o m @Override public boolean hasMilestonesToInvoice(ContractsAndGrantsBillingAward award) { boolean hasMilestonesToInvoice = true; if (award.getBillingFrequencyCode().equalsIgnoreCase(ArConstants.MILESTONE_BILLING_SCHEDULE_CODE)) { List<Milestone> milestones = new ArrayList<Milestone>(); List<Milestone> validMilestones = new ArrayList<Milestone>(); Map<String, Object> map = new HashMap<String, Object>(); map.put(KFSPropertyConstants.PROPOSAL_NUMBER, award.getProposalNumber()); map.put(KFSPropertyConstants.ACTIVE, true); milestones = (List<Milestone>) businessObjectService.findMatching(Milestone.class, map); // To retrieve the previous period end Date to check for milestones and billing schedule. Timestamp ts = new Timestamp(new java.util.Date().getTime()); java.sql.Date today = new java.sql.Date(ts.getTime()); AccountingPeriod currPeriod = accountingPeriodService.getByDate(today); java.sql.Date[] pair = verifyBillingFrequencyService .getStartDateAndEndDateOfPreviousBillingPeriod(award, currPeriod); java.sql.Date invoiceDate = pair[1]; for (Milestone awdMilestone : milestones) { if (awdMilestone.getMilestoneActualCompletionDate() != null && !invoiceDate.before(awdMilestone.getMilestoneActualCompletionDate()) && !awdMilestone.isBilled() && awdMilestone.getMilestoneAmount().isGreaterThan(KualiDecimal.ZERO)) { validMilestones.add(awdMilestone); } } if (CollectionUtils.isEmpty(validMilestones)) { hasMilestonesToInvoice = false; } } return hasMilestonesToInvoice; }
From source file:com.agiletec.plugins.jpcontentfeedback.aps.system.services.contentfeedback.comment.CommentDAO.java
/** * Dato il resultSet, ne estrae i dati e popola l'oggetto comment * @param res/*from w ww. j av a 2s. c om*/ * @return * @throws ApsSystemException */ private Comment popualteComment(ResultSet res) throws ApsSystemException { Comment comment = new Comment(); try { comment.setId(res.getInt("id")); comment.setContentId(res.getString("contentid")); Timestamp creationDate = res.getTimestamp("creationDate"); if (null != creationDate) { comment.setCreationDate(new Date(creationDate.getTime())); } comment.setComment(res.getString("usercomment")); comment.setStatus(res.getInt("status")); comment.setUsername(res.getString("username")); } catch (Throwable t) { throw new ApsSystemException("Errore loading comment", t); } return comment; }
From source file:org.kuali.rice.core.impl.datetime.DateTimeServiceImpl.java
/** * @throws ParseException// ww w.j a v a 2s. co m * @see org.kuali.rice.core.api.datetime.DateTimeService#convertToSqlDate(java.sql.Timestamp) */ public java.sql.Date convertToSqlDate(Timestamp timestamp) throws ParseException { return new java.sql.Date(timestamp.getTime()); }
From source file:com.adito.tunnels.JDBCTunnelDatabase.java
Tunnel buildTunnel(ResultSet rs) throws Exception { Timestamp cd = rs.getTimestamp("date_created"); Calendar c = Calendar.getInstance(); c.setTimeInMillis(cd == null ? System.currentTimeMillis() : cd.getTime()); Timestamp ad = rs.getTimestamp("date_amended"); Calendar a = Calendar.getInstance(); a.setTimeInMillis(ad == null ? System.currentTimeMillis() : ad.getTime()); return new DefaultTunnel(rs.getInt("realm_id"), rs.getString("name"), rs.getString("description"), rs.getInt("tunnel_id"), rs.getInt("type"), rs.getBoolean("auto_start"), rs.getString("transport"), rs.getString("username"), rs.getInt("source_port"), new HostService(rs.getString("destination_host"), rs.getInt("destination_port")), rs.getString("source_interface"), c, a); }
From source file:org.mot.common.util.DateBuilder.java
public Long convertTimestampToLong(Timestamp ts) { return ts.getTime(); }
From source file:com.hihframework.core.utils.DateUtils.java
/** * ????//ww w. j ava 2 s . c o m * ?XX-XX????XX-XX? * * @param startTime * @param endTime ? * @return */ public static String getTimeSlice(Timestamp startTime, Timestamp endTime) { String rtn = ""; Calendar caleStart = Calendar.getInstance(); Calendar caleEnd = Calendar.getInstance(); caleStart.setTimeInMillis(startTime.getTime()); caleEnd.setTimeInMillis(endTime.getTime()); String dayStart = caleStart.get(Calendar.YEAR) + "" + (caleStart.get(Calendar.MONTH) + 1) + "" + caleStart.get(Calendar.DAY_OF_MONTH) + ""; String dayEnd = caleEnd.get(Calendar.YEAR) + "" + (caleEnd.get(Calendar.MONTH) + 1) + "" + caleEnd.get(Calendar.DAY_OF_MONTH) + ""; if (dayStart.equals(dayEnd)) { // ? rtn = caleStart.get(Calendar.HOUR_OF_DAY) + "" + caleStart.get(Calendar.MINUTE) + "-" + caleEnd.get(Calendar.HOUR_OF_DAY) + "" + caleEnd.get(Calendar.MINUTE) + ""; } else { // ?? rtn = (caleStart.get(Calendar.MONTH) + 1) + "" + caleStart.get(Calendar.DAY_OF_MONTH) + "" + "-" + (caleEnd.get(Calendar.MONTH) + 1) + "" + caleEnd.get(Calendar.DAY_OF_MONTH) + ""; } caleStart = null; caleEnd = null; return rtn; }
From source file:jp.co.ctc_g.jfw.core.util.Dates.java
/** * ??{@link java.sql.Timestamp java.sql.Timestamp}??? * {@link java.util.Date java.util.Date} ???. * @param date /*from ww w.j a va2 s .c om*/ * @return ???{@link java.util.Date java.util.Date} */ public static java.util.Date getDate(Timestamp date) { return new java.util.Date(date.getTime()); }
From source file:org.mot.common.util.DateBuilder.java
public Date convertTimestampToDate(Timestamp ts) { Date date = new Date(ts.getTime()); return date; }