Examples of TimeZone


Examples of java.util.TimeZone

        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

Examples of java.util.TimeZone

    }

    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

Examples of java.util.TimeZone

        return s;
    }

    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        TimeZone tz = dynEnv.implicitTimezone();
        int utcOffset = tz.getOffset(0);
        final Duration d = XsDatatypeFactory.createDuration(utcOffset);
        return new DurationValue(d, DayTimeDurationType.DAYTIME_DURATION);
    }
View Full Code Here

Examples of java.util.TimeZone

        Item first = argv.getItem(0);
        DateTimeValue arg = (DateTimeValue) first;
        XMLGregorianCalendar cal = arg.getValue();
        final long utcOffsetInMillis;
        if(arglen == 1) {
            TimeZone tz = dynEnv.implicitTimezone();
            utcOffsetInMillis = tz.getRawOffset();
        } else if(arglen == 2) {
            Item sec = argv.getItem(1);
            if(sec.isEmpty()) {
                cal.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
                return arg;
View Full Code Here

Examples of java.util.TimeZone

    }
    if (o instanceof TimeZone == false)
    {
      throw new BeanException("Failed to convert object of type " + o.getClass() + ": Not a timezone.");
    }
    final TimeZone tz = (TimeZone) o;
    return tz.getID();
  }
View Full Code Here

Examples of java.util.TimeZone

    super.setFormatter(dfmt);
  }

  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

Examples of java.util.TimeZone

      {
        // return the default to-string behavior of java.util.Date
        formatStringRaw = "EEE MMM dd HH:mm:ss zzz yyyy";
      }
      final Locale locale = runtime.getResourceBundleFactory().getLocale();
      final TimeZone timeZone = runtime.getResourceBundleFactory().getTimeZone();
      final SimpleDateFormat dateFormat = new SimpleDateFormat(String.valueOf(formatStringRaw), locale);
      dateFormat.setDateFormatSymbols(new DateFormatSymbols(locale));
      dateFormat.setTimeZone(timeZone);
      return dateFormat.format(staticValue);
    }
View Full Code Here

Examples of java.util.TimeZone

    }

    try
    {
      final Locale locale = runtime.getResourceBundleFactory().getLocale();
      final TimeZone timeZone = runtime.getResourceBundleFactory().getTimeZone();
      if (dateFormat == null)
      {
        this.formatString = String.valueOf(formatStringRaw);
        this.locale = locale;
        this.timeZone = timeZone;
View Full Code Here

Examples of java.util.TimeZone

      }
    }
  }
 
  private Float getUptime(HttpServletRequest aRequest){
    TimeZone tz = (TimeZone)getExistingSession().getServletContext().getAttribute(Controller.TIME_ZONE);
    DateTime now = DateTime.now(tz);
    DateTime startup = getStartTime();
    int SECONDS_PER_DAY = 86400;
    return new Float(startup.numSecondsFrom(now)/SECONDS_PER_DAY);
  }
View Full Code Here

Examples of java.util.TimeZone

        LOG.log(Level.FINE, "server sending reply: ", reply);

        long timeToLive = 0;
        if (request.getJMSExpiration() > 0) {
            TimeZone tz = new SimpleTimeZone(0, "GMT");
            Calendar cal = new GregorianCalendar(tz);
            timeToLive =  request.getJMSExpiration() - cal.getTimeInMillis();
        }
       
        if (timeToLive >= 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.