List of usage examples for org.joda.time DateTime toCalendar
public Calendar toCalendar(Locale locale)
java.util.Calendar
, assigning exactly the same millisecond instant. From source file:aplicacion.control.AsignarHorasExtrasController.java
void addDaysColumns(int count) { DateTime fecha = new DateTime(inicio.getTime()); fecha = fecha.plusDays(count);/* w w w . j a v a 2s . c o m*/ String day = fecha.toCalendar(Locale.getDefault()).getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault()); TableColumn columna = new TableColumn(day + " " + fecha.getDayOfMonth() + "/" + fecha.getMonthOfYear()); columna.setPrefWidth(120); columna.setStyle("-fx-alignment: center;"); columna.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<EmpleadoTable, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(TableColumn.CellDataFeatures<EmpleadoTable, String> data) { if (data.getValue().getExtras() == null) return null; return new ReadOnlyStringWrapper(getTextHorario(data.getValue().getExtras().get(count))); } }); empleadosTableView.getColumns().add(columna); }
From source file:cherry.foundation.type.mybatis.JodaDateTimeTypeHandler.java
License:Apache License
@Override public void setNonNullParameter(PreparedStatement ps, int i, DateTime parameter, JdbcType jdbcType) throws SQLException { ps.setTimestamp(i, new Timestamp(parameter.toDate().getTime()), parameter.toCalendar(null)); }
From source file:cherry.foundation.type.querydsl.DateTimeType.java
License:Apache License
@Override public void setValue(PreparedStatement st, int startIndex, DateTime value) throws SQLException { st.setTimestamp(startIndex, new Timestamp(value.toDate().getTime()), value.toCalendar(null)); }
From source file:com.aurel.track.util.DateTimeUtils.java
License:Open Source License
public static DateTime getZeroTimeDateTime(DateTime dateParam) { Calendar calendar = dateParam.toCalendar(Locale.getDefault()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return new DateTime(calendar.getTime()); }
From source file:com.coderoad.automation.common.util.DateUtil.java
License:Open Source License
/** * Gets the calendar./*from ww w .j a v a 2 s . c o m*/ * * @param dateTime the date time * @param pattern the pattern * @return the calendar * @throws ParseException the parse exception */ public static Calendar getCalendar(final String dateTime, String pattern) throws ParseException { DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); DateTime dt = fmt.parseDateTime(dateTime); return dt.toCalendar(Locale.ENGLISH); }
From source file:com.coderoad.automation.common.util.DateUtil.java
License:Open Source License
/** * Gets the calendar./*from w w w .j a v a2 s . co m*/ * * @param dateTime the date time * @param pattern the pattern * @param timeZone the time zone * @return the calendar * @throws ParseException the parse exception */ public static Calendar getCalendar(String dateTime, final String pattern, String timeZone) throws ParseException { DateTime dt = new DateTime(DateTimeZone.forID(timeZone)); Calendar calendar = dt.toCalendar(Locale.ENGLISH); SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.ENGLISH); Date date = sdf.parse(dateTime); calendar.setTime(date); return calendar; }
From source file:com.coderoad.automation.common.util.DateUtil.java
License:Open Source License
/** * Gets the calendar for time zone./*w w w . ja va2 s .c o m*/ * * @param timeZone the time zone * @return the calendar for time zone * @throws ParseException the parse exception */ public static Calendar getCalendarForTimeZone(final String timeZone) throws ParseException { DateTime dateTime = new DateTime(DateTimeZone.forID(timeZone)); Calendar tzCalendar = dateTime.toCalendar(Locale.ENGLISH); return tzCalendar; }
From source file:com.coderoad.automation.common.util.DateUtil.java
License:Open Source License
/** * Gets the calendar for date./*w ww . ja v a 2 s . c o m*/ * * @param date the date * @return the calendar for date */ public static Calendar getCalendarForDate(final Date date) { DateTime dt = new DateTime(date); Calendar calendar = dt.toCalendar(Locale.ENGLISH); calendar.setTime(date); return calendar; }
From source file:com.coderoad.automation.common.util.DateUtil.java
License:Open Source License
/** * Parses the to utc calendar.// www . j a va 2 s. c o m * * @param timestamp the timestamp * @param pattern the pattern * @return the calendar */ public static Calendar parseToUTCCalendar(String timestamp, String pattern) { DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); fmt = fmt.withZoneUTC(); DateTime dt = fmt.parseDateTime(timestamp); dt = dt.toDateTime(DateTimeZone.UTC); return dt.toCalendar(Locale.ENGLISH); }
From source file:com.ecofactor.qa.automation.util.DateUtil.java
License:Open Source License
/** * Gets the calendar./*w ww .j a v a 2 s.c om*/ * @param timeStamp the time stamp * @param dateFormat the date format * @return the calendar * @throws ParseException the parse exception */ public static Calendar getCalendar(String timeStamp, final String dateFormat) throws ParseException { DateTime dt = new DateTime(DateTimeZone.UTC); Calendar calendar = dt.toCalendar(Locale.ENGLISH); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FMT_FULL, Locale.ENGLISH); Date date = sdf.parse(timeStamp); calendar.setTime(date); return calendar; }