List of usage examples for org.joda.time DateTime DateTime
public DateTime(Object instant)
From source file:be.nielsbril.clicket.app.viewmodels.ParkFragmentViewModel.java
private void startSession() { ApiHelper.subscribe(/*from w ww .java 2s .com*/ ClicketInstance.getClicketserviceInstance().startSession(Double.toString(mLocation.getLatitude()), Double.toString(mLocation.getLongitude()), mId, AuthHelper.getAuthToken(mContext)), new Action1<SessionSingleResult>() { @Override public void call(SessionSingleResult sessionSingleResult) { if (sessionSingleResult != null && sessionSingleResult.isSuccess()) { setSession(sessionSingleResult.getData()); startButton(false); stopButton(true); DateTime start = new DateTime(getSession().getStarted_on()); start = start.withZone(dateTimeZone); setStarted_on(start.toString(dateTimeFormatter)); setStopped_on("n.a."); setZone(getSession().getZone_id().getName() + " (" + getSession().getStreet() + ")"); setCar(getSession().getCar_id().getName() + " (" + getSession().getCar_id().getLicense_plate() + ")"); setCost(0); } else { showSnackbar("Error when starting session: zone not found, Clicket won't work here"); } } }); }
From source file:be.nielsbril.clicket.app.viewmodels.ParkFragmentViewModel.java
private void stop() { ApiHelper.subscribe(ClicketInstance.getClicketserviceInstance().stopSession(getSession().get_id(), AuthHelper.getAuthToken(mContext)), new Action1<SessionStopResult>() { @Override// w ww. j a v a 2s . c o m public void call(SessionStopResult sessionStopResult) { if (sessionStopResult != null && sessionStopResult.isSuccess()) { setSession(null); startButton(true); stopButton(false); DateTime stop = new DateTime(sessionStopResult.getData().getSession().getStopped_on()); stop = stop.withZone(dateTimeZone); setStopped_on(stop.toString(dateTimeFormatter)); setCost(sessionStopResult.getData().getInfo().getPrice().getTotal()); showSnackbar( "Stopped your session. You parked for " + Utils.roundToDecimals( sessionStopResult.getData().getInfo().getPrice().getTotal(), 2) + "."); updateUser(); } else { showSnackbar("Error when stopping session"); } } }); }
From source file:bean.Ouvrage.java
public String afficherDate() { DateTime date = new DateTime(this.getDatePublication()); return date.toLocalDate().toString(); }
From source file:bean.Pret.java
public String afficherDatePret() { DateTime date = new DateTime(this.getDatePret()); return date.toLocalDate().toString(); }
From source file:bean.Pret.java
public String afficherDateRetour() { DateTime date = new DateTime(this.getDateRetour()); return date.toLocalDate().toString(); }
From source file:beans.utilidades.MetodosGenerales.java
public boolean fechaDentroDeRangoMas1Dia(Date inicioRango, Date finRango, Date fecBuscada) { //determinar si una fecha esta dentro de un rango; true = fecha en el rango //se suma 1 dia a la fecha final para que incluya el ultimo dia Interval interval = new Interval(new DateTime(inicioRango), new DateTime(finRango).plusDays(1)); return interval.contains(new DateTime(fecBuscada)); }
From source file:beans.utilidades.MetodosGenerales.java
private boolean fechaDentroDeRango(Date inicioRango, Date finRango, Date fecBuscada) { //determinar si una fecha esta dentro de un rango; true = fecha en el rango //no es necesario aumentar el dia final por que se evaluan ambos limites de ambos rangos Interval interval = new Interval(new DateTime(inicioRango), new DateTime(finRango)); return interval.contains(new DateTime(fecBuscada)); }
From source file:beans.utilidades.MetodosGenerales.java
public String calcularEdad(Date fechaNacimiento) {//calcular la edad a partir de la fecha de nacimiento Period periodo = new Period(new DateTime(fechaNacimiento), new DateTime(new Date())); return String.valueOf(periodo.getYears()) + "A " + String.valueOf(periodo.getMonths()) + "M "; }
From source file:beans.utilidades.MetodosGenerales.java
public int calcularEdadInt(Date fechaNacimiento) {//calcular la edad en aos Period periodo = new Period(new DateTime(fechaNacimiento), new DateTime(new Date())); if (periodo.getYears() == 0) { return 1; } else {//w w w . j a v a 2 s .c om return periodo.getYears(); } }
From source file:betalabs.libtests.unfolding.AnimatedTemporalDotsApp.java
License:Open Source License
public void setup() { size(1900, 1000, OPENGL);/* ww w .j a v a 2 s .co m*/ frame.setResizable(true); smooth(); //map = new UnfoldingMap(this); map = new UnfoldingMap(this, 0, 0, 1900, 800, new Microsoft.HybridProvider()); map.zoomToLevel(2); map.setTweening(true); MapUtils.createMouseEventDispatcher(this, map); print("Loading earthquakes from web feed ... "); List<Feature> features = GeoRSSReader.loadDataGeoRSS(this, earthquakesURL); println("done."); markers = MapUtils.createSimpleMarkers(features); // Earthquakes are ordered from latest to oldest startTime = new DateTime(features.get(features.size() - 1).getProperty("date")); endTime = new DateTime(features.get(0).getProperty("date")); currentTime = startTime.plus(0); println("Dates of earthquakes ranges from " + startTime + " to " + endTime); Ani.init(this); }