List of usage examples for org.joda.time DateTimeZone toTimeZone
public java.util.TimeZone toTimeZone()
From source file:org.jruby.RubyTime.java
License:LGPL
private IRubyObject inspectCommon(DateTimeFormatter formatter, DateTimeFormatter utcFormatter) { DateTimeFormatter simpleDateFormat; if (dt.getZone() == DateTimeZone.UTC) { simpleDateFormat = utcFormatter; } else {/* w w w. j a v a 2s.c o m*/ simpleDateFormat = formatter; } String result = simpleDateFormat.print(dt); if (isTzRelative) { // display format needs to invert the UTC offset if this object was // created with a specific offset in the 7-arg form of #new DateTimeZone dtz = dt.getZone(); int offset = dtz.toTimeZone().getOffset(dt.getMillis()); DateTimeZone invertedDTZ = DateTimeZone.forOffsetMillis(offset); DateTime invertedDT = dt.withZone(invertedDTZ); result = simpleDateFormat.print(invertedDT); } return RubyString.newString(getRuntime(), result, USASCIIEncoding.INSTANCE); }
From source file:org.n52.io.type.quantity.handler.img.ChartIoHandler.java
License:Open Source License
private void configureTimeAxis(XYPlot plot) { DateAxis timeAxis = (DateAxis) plot.getDomainAxis(); final Date start = getStartTime(getTimespan()); final Date end = getEndTime(getTimespan()); timeAxis.setRange(start, end);//from w ww.j av a 2s . c o m final Locale locale = i18n.getLocale(); IoParameters parameters = getParameters(); String timeformat = parameters.getTimeFormat(); DateFormat requestTimeFormat = new SimpleDateFormat(timeformat, locale); final DateTimeZone timezone = getTimezone(); requestTimeFormat.setTimeZone(timezone.toTimeZone()); timeAxis.setDateFormatOverride(requestTimeFormat); timeAxis.setTimeZone(timezone.toTimeZone()); }