java.util.TimeZone里的这个方法
public int getOffset(long date)是返回时区偏移量的.我想问的是这个方法为什么会要date这个参数,我也试验过,date这个值无论取什么都不会对返回值产生影响啊!那为什么还要这个参数呢?这样有什么用吗?

解决方案 »

  1.   

    多看看源代码和api吧。 /**
         * Returns the offset of this time zone from UTC at the specified
         * date. If Daylight Saving Time is in effect at the specified
         * date, the offset value is adjusted with the amount of daylight
         * saving.
         * <p>
         * This method returns a historically correct offset value if an
         * underlying TimeZone implementation subclass supports historical
         * Daylight Saving Time schedule and GMT offset changes.
         *
         * @param date the date represented in milliseconds since January 1, 1970 00:00:00 GMT
         * @return the amount of time in milliseconds to add to UTC to get local time.
         *
         * @see Calendar#ZONE_OFFSET
         * @see Calendar#DST_OFFSET
         * @since 1.4
         */
      

  2.   

    楼主请API
    或者是直接源码