List of usage examples for org.joda.time DateTime DateTime
public DateTime()
ISOChronology
in the default time zone. From source file:biz.dfch.j.graylog2.plugin.input.dfchBizExecScript.java
License:Apache License
@Override public void launch(final Buffer buffer) throws MisfireException { System.out.printf("*** " + DF_PLUGIN_NAME + "::launch()\r\n"); try {//from www. ja v a 2 s. c om // while(_isRunning) // { //wait(250); DateTime dateTime = new DateTime(); String msgString = String.format("%d: %s, %s", _counter.incrementAndGet(), _configuration.getString("DF_PLUGIN_NAME"), dateTime.toString()); Message msg = new Message(msgString, _configuration.getString("DF_PLUGIN_NAME"), dateTime); buffer.insertCached(msg, dfchBizExecScript.this); // } } // catch(MisfireException ex) // { // LOG.error("*** " + DF_PLUGIN_NAME + "::launch() - MisfireException"); // ex.printStackTrace(); // } catch (Exception ex) { LOG.error("*** " + DF_PLUGIN_NAME + "::launch() - Exception"); System.out.printf("*** " + DF_PLUGIN_NAME + "::launch() - Exception\r\n"); ex.printStackTrace(); } }
From source file:bo.com.edusoft.basic.Util.java
public static Integer getCurrentMonth() { DateTime jodaDateTime = new DateTime(); return jodaDateTime.getMonthOfYear(); }
From source file:boundary.AuctionUserFacade.java
/** * Method returns a list of auctions. If '@isOver' is true and the user * is a customer, it returns a list of auctions the customer has won, else if * false it returns auctions ongoing the customer has bid on. * If '@isOver' is true and user is seller, method returns a list of finished * auctions published by the seller, else a list of ongoing auctions. * // w w w. j av a2 s . c o m * @param isOver * boolean variable to check if auction is finished * @return * LinkedList of auctions */ public List getAuctions(boolean isOver) { LinkedList<Integer> list = new LinkedList<Integer>(); HashSet<Auction> auctionList = new HashSet<Auction>(); Auction auction; DateTime nowDate = new DateTime(); DateTime dateTime = new DateTime(); AuctionUser user = getAuctionUser(); if (user != null) { if (user.getRole().equals("customer")) { list.addAll(em.createQuery( //query to retrieve all auctions with bids "SELECT b.auction.id FROM Bid as b WHERE b.auctionUser.id =" + user.getId()) .getResultList()); } else if (user.getRole().equals("seller")) { list.addAll(em.createQuery( //query to retrieve all auctions "SELECT a.id FROM Auction as a WHERE a.user.id =" + user.getId()).getResultList()); } } else { list.addAll(em.createQuery( //query to retrieve all auctions "SELECT a.id FROM Auction as a WHERE a.user.id =" + user.getId()).getResultList()); } //Adding winning auctions to the winningList for (int i = 0; i < list.size(); i++) { auction = em.find(Auction.class, list.get(i)); dateTime = new DateTime(auction.getStartTime().clone()); dateTime = dateTime.plusSeconds(Math.toIntExact(auction.getDuration())); if (isOver) { //if auction is done if (dateTime.compareTo(nowDate) <= 0) { auctionList.add(auction); } } else { //if auction is still ongoing if (dateTime.compareTo(nowDate) > 0) { auctionList.add(auction); } } } LinkedList<Auction> listOfAuctions = new LinkedList<Auction>(); listOfAuctions.addAll(auctionList); return listOfAuctions; }
From source file:br.com.bob.dashboard.web.beans.HistoryBean.java
private void buildWeeks() { final DateTime dt = new DateTime(); weekDates = new ArrayList<>(); weekDates.add(utils.onlyDate(dt.toDate())); for (int i = 1; i < 7; i++) { final String result = utils.onlyDate(dt.minusDays(i).toDate()); weekDates.add(result);//from w ww . j a v a2 s. co m } }
From source file:br.com.bob.dashboard.web.util.Utils.java
public Date today() { final DateTime dt = new DateTime().hourOfDay().setCopy(0).minuteOfHour().setCopy(0).secondOfMinute() .setCopy(0).toDateTime();//from w ww.j a va 2 s. co m return dt.toDate(); }
From source file:br.com.ma1s.eva.service.listener.ProcessDeposit.java
public void listen(@Observes @Deposit PropertyCustomer pc) { final BigDecimal rentValue = pc.getProperty().getValue(); final BigInteger result = pc.getDepositValue().divide(rentValue).toBigInteger(); for (int i = 0; i < result.intValue(); i++) { final PaymentRegister payment = build(pc); payment.setDate(new DateTime().plusMonths(i).toDate()); prDAO.save(payment);// w ww.ja va2 s .c o m } }
From source file:br.com.ma1s.eva.service.PaymentService.java
public PaymentService() { final DateTime dt = new DateTime().dayOfMonth().setCopy(1); this.monthBegin = dt.toDate(); this.monthEnd = dt.plusDays(30).toDate(); }
From source file:br.com.moonjava.flight.controller.financeiro.CartaoCreate.java
License:Apache License
@Override public DateTime getDataDeCriacao() { return new DateTime(); }
From source file:br.com.nerv.eva.service.listener.ProcessDeposit.java
@Transactional public void listen(@Observes @Deposit PropertyCustomer pc) { final BigDecimal rentValue = pc.getProperty().getValue(); final BigInteger result = pc.getDepositValue().divide(rentValue).toBigInteger(); for (int i = 0; i < result.intValue(); i++) { final PaymentRegister payment = build(pc); payment.setDate(new DateTime().plusMonths(i).toDate()); prDAO.save(payment);//from ww w . j a va 2s . c o m } }
From source file:br.com.nerv.eva.service.listener.ProcessSellDeposit.java
@Transactional public void listen(@Observes @Sell PropertyCustomer pc) { final String value = format(pc.getProperty().getValue()); if (!value.equals(format(pc.getDepositValue()))) { throw new BusinessException("O valor do depsito no corresponde " + "ao valor anunciado"); }//from w w w .j a v a 2 s. c o m DateTime dt = new DateTime(); if (dt.dayOfMonth().get() <= pc.getPaymentDay()) dt.plusMonths(1); PaymentRegister payment = build(pc); payment.setDate(dt.dayOfMonth().setCopy(pc.getPaymentDay()).toDate()); prDAO.save(payment); }