Package java.util

Examples of java.util.SimpleTimeZone


     * is used.
     */
    public Time(
        Date    date)
    {
        SimpleTimeZone      tz = new SimpleTimeZone(0, "Z");
        SimpleDateFormat    dateF = new SimpleDateFormat("yyyyMMddHHmmss");

        dateF.setTimeZone(tz);

        String  d = dateF.format(date) + "Z";
View Full Code Here


  /**
   * @tests java.util.TimeZone#setDefault(java.util.TimeZone)
   */
  public void test_setDefaultLjava_util_TimeZone() {
    TimeZone oldDefault = TimeZone.getDefault();
    TimeZone zone = new SimpleTimeZone(45, "TEST");
    TimeZone.setDefault(zone);
    assertEquals("timezone not set", zone, TimeZone.getDefault());
    TimeZone.setDefault(null);
    assertEquals("default not restored",
                             oldDefault, TimeZone.getDefault());
View Full Code Here

    // value
    assertTrue("Incorrect calendar returned",
        gc1.get(Calendar.HOUR) == ((gc2.get(Calendar.HOUR) + 1) % 12));
       
        // Regression test for HARMONY-2961
        SimpleTimeZone timezone = new SimpleTimeZone(-3600 * 24 * 1000 * 2,
                "GMT");
        GregorianCalendar gc = new GregorianCalendar(timezone);
  }
View Full Code Here

        test.test(" zzzz", temp2, " Eastern Standard Time",
                DateFormat.TIMEZONE_FIELD);
        test.test(" zzzzz", cal, " Eastern Daylight Time",
                DateFormat.TIMEZONE_FIELD);

        format.setTimeZone(new SimpleTimeZone(60000, "ONE MINUTE"));
        test.test(" z", cal, " GMT+00:01", DateFormat.TIMEZONE_FIELD);
        test.test(" zzzz", cal, " GMT+00:01", DateFormat.TIMEZONE_FIELD);
        format.setTimeZone(new SimpleTimeZone(5400000, "ONE HOUR, THIRTY"));
        test.test(" z", cal, " GMT+01:30", DateFormat.TIMEZONE_FIELD);
        format
                .setTimeZone(new SimpleTimeZone(-5400000,
                        "NEG ONE HOUR, THIRTY"));
        test.test(" z", cal, " GMT-01:30", DateFormat.TIMEZONE_FIELD);

        format.applyPattern("'Mkz''':.@5");
        assertEquals("Wrong output", "Mkz':.@5", format.format(new Date()));
View Full Code Here

            }

            Destination replyTo = getReplyToDestination(jmsTemplate, inMessage);

            if (request.getJMSExpiration() > 0) {
                TimeZone tz = new SimpleTimeZone(0, "GMT");
                Calendar cal = new GregorianCalendar(tz);
                long timeToLive = request.getJMSExpiration() - cal.getTimeInMillis();
                if (timeToLive < 0) {
                    getLogger()
                        .log(Level.INFO, "Message time to live is already expired skipping response.");
View Full Code Here

        calendar.set(Calendar.DAY_OF_MONTH, 22);
        calendar.set(Calendar.HOUR_OF_DAY, 11);
        calendar.set(Calendar.MINUTE, 30);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.setTimeZone(new SimpleTimeZone(60 * 60 * 1000, "Apache/Jakarta"));

        assertEquals("parsed date", calendar.getTime(), parser.parseDate("<*D2002-03-22 11:30:00 +0100>"));
    }
View Full Code Here

      throws SQLException {
    Statement stat = conn.createStatement();
    stat.execute("create table ts(x timestamp primary key)");
    stat.execute("create table t(x time primary key)");
    stat.execute("create table d(x date)");
    Calendar utcCalendar = new GregorianCalendar(new SimpleTimeZone(0, "Z"));
    TimeZone old = TimeZone.getDefault();
    DateTimeUtils.resetCalendar();
    TimeZone.setDefault(TimeZone.getTimeZone("PST"));
    try {
      Timestamp ts1 = Timestamp.valueOf("2010-03-13 18:15:00");
View Full Code Here

        try {
            if (requestInformation.get().handle && requestInformation.get().client.getIsActive()) {
                logger.info("Storing history");
                String createdDate;
                SimpleDateFormat sdf = new SimpleDateFormat();
                sdf.setTimeZone(new SimpleTimeZone(0, "GMT"));
                sdf.applyPattern("dd MMM yyyy HH:mm:ss");
                createdDate = sdf.format(new Date()) + " GMT";

                history.setCreatedAt(createdDate);
                history.setRequestURL(HttpUtilities.getURL(httpMethodProxyRequest.getURI().toString()));
View Full Code Here

     * is used.
     */
    public Time(
        Date    date)
    {
        SimpleTimeZone      tz = new SimpleTimeZone(0, "Z");
        SimpleDateFormat    dateF = new SimpleDateFormat("yyyyMMddHHmmss");

        dateF.setTimeZone(tz);

        String  d = dateF.format(date) + "Z";
View Full Code Here

    public void doGet(HttpServletRequest req,
                      HttpServletResponse resp)
        throws IOException, ServletException {

        SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS");
        fmt.setTimeZone(new SimpleTimeZone(0, ""));

        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();
        String loginUrl = userService.createLoginURL("/");
        String logoutUrl = userService.createLogoutURL("/");

        Entity userPrefs = null;
        if (user != null) {
            DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
            MemcacheService memcache = MemcacheServiceFactory.getMemcacheService();

            String cacheKey = "UserPrefs:" + user.getUserId();
            userPrefs = (Entity) memcache.get(cacheKey);
            if (userPrefs == null) {
                log.warning("CACHE MISS");

                Key userKey = KeyFactory.createKey("UserPrefs", user.getUserId());
                try {
                    userPrefs = ds.get(userKey);
                    memcache.put(cacheKey, userPrefs);
                } catch (EntityNotFoundException e) {
                    // No user preferences stored.
                }
            } else {
                log.warning("CACHE HIT");
            }
        }

        if (userPrefs != null) {
            int tzOffset = ((Long) userPrefs.getProperty("tz_offset")).intValue();
            fmt.setTimeZone(new SimpleTimeZone(tzOffset * 60 * 60 * 1000, ""));
            req.setAttribute("tzOffset", tzOffset);
        } else {
            req.setAttribute("tzOffset", 0);
        }

View Full Code Here

TOP

Related Classes of java.util.SimpleTimeZone

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.