@Override public GroundedTime setTimeZone(DateTimeZone tz) { MutableDateTime tzBase = base.toInstant().toMutableDateTime(); tzBase.setZone(tz); // TODO: setZoneRetainFields? return new GroundedTime(this, tzBase); }
dt.setZone(iZone);
dt.setZone(iZone);
dt.setZone(iZone);
//this is the mutable version of DateTime, set to UTC as default MutableDateTime currentTime = new DateTime(2015, 1, 23, 2, 0, DateTimeZone.UTC).toMutableDateTime(); // CONSTANT // Looking for something that can perform this type of method. currentTime.setZone(DateTimeZone.forID("Asia/Tokyo")); System.out.println("Asia/Tokyo Time : " + currentTime); currentTime.setZone(DateTimeZone.forID("America/Montreal")); System.out.println("America/Montreal Time : " + currentTime); //if you want to return a value in DateTime datatype currentTime.toDateTime();
public static DateTime parseDate(String s) { if (s.endsWith("Z")) { MutableDateTime dateTime = ZULU_FORMATTER.parseMutableDateTime(s); dateTime.setZone(DateTimeZone.UTC); return dateTime.toDateTime(); } else if (Character.isLetter(s.charAt(0))){ DateTime dateTime = JodaDate.parseQuietly(ALPHA_FORMATTER2, s); if (dateTime == null) { dateTime = JodaDate.parseQuietly(ALPHA_FORMATTER1, s); } return dateTime; } else { return DATETIME_FORMATTER.parseDateTime(s); } }
@Override public GroundedTime setTimeZone(DateTimeZone tz) { MutableDateTime tzBase = base.toInstant().toMutableDateTime(); tzBase.setZone(tz); // TODO: setZoneRetainFields? return new GroundedTime(this, tzBase); }
public GroundedTime setTimeZone(DateTimeZone tz) { MutableDateTime tzBase = base.toInstant().toMutableDateTime(); tzBase.setZone(tz); // TODO: setZoneRetainFields? return new GroundedTime(this, tzBase); }
private void updateDateTime(Object datetime, Integer hours, Integer minutes, AjaxRequestTarget target) { MutableDateTime date = new MutableDateTime(datetime); try { TimeZone zone = getClientTimeZone(); if (zone != null) { date.setZone(DateTimeZone.forTimeZone(zone)); } if (hours != null) { date.set(DateTimeFieldType.hourOfDay(), hours.intValue() % 24); date.setMinuteOfHour((minutes != null) ? minutes.intValue() : 0); } // the date will be in the server's timezone setModelObject(date.toDate()); if (target != null) { target.add(this); } } catch (RuntimeException e) { error(e.getMessage()); invalid(); } }
private void updateDateTime(Object datetime, Integer hours, Integer minutes, AjaxRequestTarget target) { MutableDateTime date = new MutableDateTime(datetime); try { TimeZone zone = getClientTimeZone(); if (zone != null) { date.setZone(DateTimeZone.forTimeZone(zone)); } if (hours != null) { date.set(DateTimeFieldType.hourOfDay(), hours.intValue() % 24); date.setMinuteOfHour((minutes != null) ? minutes.intValue() : 0); } // the date will be in the server's timezone setModelObject(date.toDate()); if (target != null) { target.addComponent(this); } } catch (RuntimeException e) { error(e.getMessage()); invalid(); } }
private void updateDateTime(Date date, Integer hours, Integer minutes) { if(date!=null) { MutableDateTime datetime = new MutableDateTime(date); try { TimeZone zone = getClientTimeZone(); if (zone != null) { datetime.setZone(DateTimeZone.forTimeZone(zone)); } if (hours != null) { datetime.set(DateTimeFieldType.hourOfDay(), hours % 24); datetime.setMinuteOfHour(minutes != null ? minutes : 0); } // the date will be in the server's timezone setDate(datetime.toDate()); //setModelObject(datetime.toDate()); } catch (RuntimeException e) { error(e.getMessage()); invalid(); } } }
private void updateDateTime(Date date, Integer hours, Integer minutes) { if(date!=null) { MutableDateTime datetime = new MutableDateTime(date); try { TimeZone zone = getClientTimeZone(); if (zone != null) { datetime.setZone(DateTimeZone.forTimeZone(zone)); } if (hours != null) { datetime.set(DateTimeFieldType.hourOfDay(), hours % 24); datetime.setMinuteOfHour(minutes != null ? minutes : 0); } // the date will be in the server's timezone setDate(datetime.toDate()); //setModelObject(datetime.toDate()); } catch (RuntimeException e) { error(e.getMessage()); invalid(); } } }
private void updateDateTime() { final Date date = getDate(); if (date != null) { final MutableDateTime dateTime = new MutableDateTime(date); try { final TimeZone zone = getClientTimeZone(); if (zone != null) { dateTime.setZone(DateTimeZone.forTimeZone(zone)); } setHourAndMinutes(dateTime); // the date will be in the server's timezone setDate(dateTime.toDate()); setModelObject(dateTime.toDate()); } catch (final RuntimeException e) { error(e.getMessage()); invalid(); } } }
dt.setZone(iZone);
if (zone != null) mDate.setZone(DateTimeZone.forTimeZone(zone));
if (zone != null) mDate.setZone(DateTimeZone.forTimeZone(zone));