Package java.util

Examples of java.util.TimeZone


  {
    if (!(o instanceof TimeZone))
    {
      throw new ObjectFactoryException("The given object is no java.util.TimeZone. ");
    }
    final TimeZone t = (TimeZone) o;
    setParameter("value", t.getID());
  }
View Full Code Here


    }

    final String formatString = entry.getParameterAttribute(ParameterAttributeNames.Core.NAMESPACE,
        ParameterAttributeNames.Core.DATA_FORMAT, parameterContext);
    final Locale locale = parameterContext.getResourceBundleFactory().getLocale();
    final TimeZone timeZone = parameterContext.getResourceBundleFactory().getTimeZone();

    sdf = createDateFormat(formatString, locale, timeZone);

    dateChooserPanel = new DateChooserPanel(Calendar.getInstance(), true);
    dateChooserPanel.addPropertyChangeListener(DateChooserPanel.PROPERTY_DATE, new InternalDateUpdateHandler());
View Full Code Here

    this.parameterName = entry.getName();

    final String formatString = entry.getParameterAttribute(ParameterAttributeNames.Core.NAMESPACE,
        ParameterAttributeNames.Core.DATA_FORMAT, parameterContext);
    final Locale locale = parameterContext.getResourceBundleFactory().getLocale();
    final TimeZone timeZone = parameterContext.getResourceBundleFactory().getTimeZone();

    final Format format =
        TextComponentEditHandler.createFormat(formatString, locale, timeZone, entry.getValueType());

    handler =
View Full Code Here

    this.updateContext = updateContext;

    final String formatString = entry.getParameterAttribute(ParameterAttributeNames.Core.NAMESPACE,
        ParameterAttributeNames.Core.DATA_FORMAT, parameterContext);
    final Locale locale = parameterContext.getResourceBundleFactory().getLocale();
    final TimeZone timeZone = parameterContext.getResourceBundleFactory().getTimeZone();

    final Format format =
        TextComponentEditHandler.createFormat(formatString, locale, timeZone, entry.getValueType());

    textArea = new JTextArea();
View Full Code Here

        long nanos;
        if (timeStart < 0) {
            nanos = 0;
        } else {
            int timeEnd = s.length();
            TimeZone tz = null;
            if (s.endsWith("Z")) {
                tz = TimeZone.getTimeZone("UTC");
                timeEnd--;
            } else {
                int timeZoneStart = s.indexOf('+', dateEnd);
                if (timeZoneStart < 0) {
                    timeZoneStart = s.indexOf('-', dateEnd);
                }
                if (timeZoneStart >= 0) {
                    String tzName = "GMT" + s.substring(timeZoneStart);
                    tz = TimeZone.getTimeZone(tzName);
                    if (!tz.getID().startsWith(tzName)) {
                        throw new IllegalArgumentException(tzName);
                    }
                    timeEnd = timeZoneStart;
                } else {
                    timeZoneStart = s.indexOf(' ', dateEnd + 1);
                    if (timeZoneStart > 0) {
                        String tzName = s.substring(timeZoneStart + 1);
                        tz = TimeZone.getTimeZone(tzName);
                        if (!tz.getID().startsWith(tzName)) {
                            throw new IllegalArgumentException(tzName);
                        }
                        timeEnd = timeZoneStart;
                    }
                }
View Full Code Here

    return value;
  }

  public Object getValue(final ExpressionRuntime runtime, final Element element)
  {
    final TimeZone timeZone = runtime.getResourceBundleFactory().getTimeZone();
    if (ObjectUtilities.equal(timeZone, this.timeZone) == false)
    {
      this.timeZone = timeZone;
      getDateFormat().setTimeZone(timeZone);
    }
View Full Code Here

        assertEquals(a1, props.getInetAddress("a1", a3));
        assertEquals(a3, props.getInetAddress("foo", a3));
    }

    public void testGetTimeZone() throws FtpException {
        TimeZone tz1 = TimeZone.getTimeZone("PST");
        TimeZone tz2 = TimeZone.getTimeZone("GMT-8:00");
        TimeZone tz3 = TimeZone.getTimeZone("foo");

        BaseProperties props = new BaseProperties();
        props.setProperty("tz1", "PST");
        props.setProperty("tz2", "GMT-8:00");
        props.setProperty("tz3", "foo");
View Full Code Here

        assertEquals(tz1, props.getTimeZone("tz1", tz2));
        assertEquals(tz2, props.getTimeZone("foo", tz2));
    }

    public void testSetTimeZone() throws FtpException {
        TimeZone tz1 = TimeZone.getTimeZone("PST");

        BaseProperties props = new BaseProperties();
        props.setProperty("tz1", tz1);

        assertEquals(tz1, props.getTimeZone("tz1"));
View Full Code Here

        int field = getDatePart(part);
        Calendar calendar = Calendar.getInstance();
        long t1 = d1.getTime(), t2 = d2.getTime();
        // need to convert to UTC, otherwise we get inconsistent results with
        // certain time zones (those that are 30 minutes off)
        TimeZone zone = calendar.getTimeZone();
        calendar.setTime(d1);
        t1 += zone.getOffset(calendar.get(Calendar.ERA), calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
                calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.DAY_OF_WEEK), calendar
                        .get(Calendar.MILLISECOND));
        calendar.setTime(d2);
        t2 += zone.getOffset(calendar.get(Calendar.ERA), calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
                calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.DAY_OF_WEEK), calendar
                        .get(Calendar.MILLISECOND));
        switch (field) {
        case Calendar.MILLISECOND:
            return t2 - t1;
View Full Code Here

    }

    private Date getNntpDate( NntpRequest nntpRequest, int startingIndex ) throws ParseException {
        String dateStr = nntpRequest.getParameter( startingIndex );
        String timeStr = nntpRequest.getParameter( startingIndex + 1 );
        TimeZone timeZone = TimeZone.getDefault();
        if( startingIndex + 2 < nntpRequest.parameterLength() ) {
            String zone = nntpRequest.getParameter( startingIndex + 2 );
            if( zone.equalsIgnoreCase("gmt") ) {
                timeZone = TimeZone.getTimeZone( zone );
            }
        }

        SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd HHmmss z");
        return formatter.parse( dateStr + " " + timeStr + " " + timeZone.getID() );
    }
View Full Code Here

TOP

Related Classes of java.util.TimeZone

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.