Package java.util

Examples of java.util.TimeZone.inDaylightTime()


        } else {
            sb.append("" + seconds);
        }

        double offset = cal.get(Calendar.ZONE_OFFSET);
        if (tz.inDaylightTime(inputDate)) {
            offset += (1.0 * tz.getDSTSavings()); // add the timezone's DST
            // value (typically 1 hour
            // expressed in milliseconds)
        }

View Full Code Here


    logger.debug("OffsetValue is " +tz.getRawOffset());
          if(tz.getRawOffset()!= 0)

          date = new Date(date.getTime() + tz.getRawOffset());
          logger.debug("After adding offset" +date);
    if ( tz.inDaylightTime( date ))
     {
        Date dstDate = new Date( date.getTime() + tz.getDSTSavings() );
       logger.debug("Day Light Saving is  "+ tz.getDSTSavings());
         logger.debug("Dst is   "+ dstDate);
View Full Code Here

     {
        Date dstDate = new Date( date.getTime() + tz.getDSTSavings() );
       logger.debug("Day Light Saving is  "+ tz.getDSTSavings());
         logger.debug("Dst is   "+ dstDate);

        if ( tz.inDaylightTime( dstDate ))
        {
           date = dstDate;
//           logger.debug("dst date  "+ dstDate);
        }
       }
View Full Code Here

        Date date = cal.getTime() ;
        TimeZone z = cal.getTimeZone() ;
        int tzOff = z.getRawOffset() ;
        int tz = tzOff ;

        if ( z.inDaylightTime(date) )
        {
            int tzDst = z.getDSTSavings() ;
            tz = tz + tzDst ;
        }
       
View Full Code Here

            }
        }
        TimeZone tz = cal.getTimeZone();
        // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
        int offset = cal.get(Calendar.ZONE_OFFSET);
        if (tz.inDaylightTime(cal.getTime())) {
            offset += cal.get(Calendar.DST_OFFSET);
        }
        if (offset == 0) {
            pBuffer.append('Z');
        } else {
View Full Code Here

      Date d=getDateValue(value,timeFormats,timeFormats);
      TimeZone tz = TimeZone.getDefault();     
      Calendar c = Calendar.getInstance(tz);
      c.setTime(d);
     
      if(timeFormats[0].equals("HH:mm:ssZ")&&(tz.inDaylightTime(d)))
        c.add(Calendar.MILLISECOND,3600000);
      return new Long(
          c.get(Calendar.HOUR_OF_DAY)*3600000
          +c.get(Calendar.MINUTE)*60000
          +c.get(Calendar.SECOND)*1000         
 
View Full Code Here

          }
        }
        TimeZone tz = cal.getTimeZone();
        // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
        int offset = cal.get(Calendar.ZONE_OFFSET);
        if (tz.inDaylightTime(cal.getTime())) {
          offset += cal.get(Calendar.DST_OFFSET);
        }
        if (offset == 0) {
            pBuffer.append('Z');
        } else {
View Full Code Here

        // Manual construction of the tz offset because only Java 7 is aware of ISO 8601 time zones
        TimeZone tz = TimeZone.getDefault();
        int offset = tz.getRawOffset();

        // Raw offset ignores DST, so check if we are in DST now and add the offset
        if ( tz.inDaylightTime( new Date( timestamp ) ) )
        {
            offset += tz.getDSTSavings();
        }

        // CHECKSTYLE_OFF: MagicNumber
View Full Code Here

          }
        }
        TimeZone tz = cal.getTimeZone();
        // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
        int offset = cal.get(Calendar.ZONE_OFFSET);
        if (tz.inDaylightTime(cal.getTime())) {
          offset += cal.get(Calendar.DST_OFFSET);
        }
        if (offset == 0) {
            pBuffer.append('Z');
        } else {
View Full Code Here

  public void test_inDaylightTimeLjava_util_Date() {
    // Test for method boolean
    // java.util.SimpleTimeZone.inDaylightTime(java.util.Date)
        TimeZone zone = TimeZone.getTimeZone("EST");
    GregorianCalendar gc = new GregorianCalendar(1998, Calendar.JUNE, 11);
    assertFalse("Returned incorrect daylight value1", zone.inDaylightTime(gc
        .getTime()));
    gc = new GregorianCalendar(1998, Calendar.NOVEMBER, 11);
        assertFalse("Returned incorrect daylight value1", zone.inDaylightTime(gc
                .getTime()));
    gc = new GregorianCalendar(zone);
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.