Code example for TimeZone

Methods: getDisplayNameinDaylightTime

0
        if (cal == null) {
            cal = new GregorianCalendar(timeZone);
            cal.set(localDate.getYear(), localDate.getMonth().intValue(), localDate.getDayOfMonth(),
                    localTime.getHour(), localTime.getMinute(), localTime.getSecond());
            cal.set(MILLISECOND, localTime.getMillis());
            inDST = timeZone.inDaylightTime(cal.getTime());
        } 
        return cal;
    } 
 
    /** 
     * @return the timeZone 
     */ 
    public final TimeZone getTimeZone() {
        return timeZone;
    } 
 
    /** 
     * {@inheritDoc} 
     * 
     * @see java.lang.Object#hashCode() 
     */ 
    // SUPPRESS CHECKSTYLE DesignForExtension 
    @Override 
    public int hashCode() { 
        return Hashcode.of(localDate, localTime, timeZone);
    } 
 
    /** 
     * {@inheritDoc} 
     * 
     * @see java.lang.Object#equals(java.lang.Object) 
     */ 
    // SUPPRESS CHECKSTYLE DesignForExtension 
    @Override 
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true; 
        } 
        if (obj == null) {
            return false; 
        } 
        if (getClass() != obj.getClass()) {
            return false; 
        } 
        final DateTime other = (DateTime) obj;
        return nullSafeEquals(this.localDate, other.localDate) && nullSafeEquals(this.localTime, other.localTime)
                && nullSafeEquals(this.timeZone, other.timeZone);
    } 
 
    /** 
     * {@inheritDoc} 
     * 
     * @see java.lang.Object#toString() 
     */ 
    // SUPPRESS CHECKSTYLE DesignForExtension 
    @Override 
    public String toString() {
        getCalendar(); 
        return this.localDate.toString() + " " + this.localTime.toString() + " " + this.timeZone.getDisplayName(inDST, SHORT);
    } 
}