Author: erodriguez Date: Thu Dec 23 19:53:23 2004 New Revision: 123270 URL: http://svn.apache.org/viewcvs?view=rev&rev=123270 Log: Updated DateUtils with constant for UTC time zone. Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/util/DateUtils.java
Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/util/DateUtils.java Url: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/util/DateUtils.java?view=diff&rev=123270&p1=incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/util/DateUtils.java&r1=123269&p2=incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/util/DateUtils.java&r2=123270 ============================================================================== --- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/util/DateUtils.java (original) +++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/util/DateUtils.java Thu Dec 23 19:53:23 2004 @@ -16,9 +16,10 @@ */ package org.apache.ldap.common.util; +import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.SimpleTimeZone; +import java.util.TimeZone; /** * Gets the generalized time using the "Z" form of the g-time-zone. @@ -28,6 +29,8 @@ */ public class DateUtils { + private static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" ); + /** * Gets the generalized time using the "Z" form of the g-time-zone * described by [<a href= @@ -96,8 +99,8 @@ */ public static String getGeneralizedTime() { - SimpleDateFormat date = new SimpleDateFormat( "yyyyMMddHHmmss'Z'" ); - date.setTimeZone( new SimpleTimeZone(0,"Z") ); + DateFormat date = new SimpleDateFormat( "yyyyMMddHHmmss'Z'" ); + date.setTimeZone( UTC_TIME_ZONE ); return date.format( new Date() ); } }
