Replace statics *TIMEZONE* with *TIME_ZONE*
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137577 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e2639fb20
commit
e92543334a
|
@ -67,8 +67,9 @@ import java.util.TimeZone;
|
|||
* @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a>
|
||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
|
||||
* @author Stephen Colebourne
|
||||
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
|
||||
* @since 2.0
|
||||
* @version $Id: DateFormatUtils.java,v 1.5 2003/08/06 02:48:23 ggregory Exp $
|
||||
* @version $Id: DateFormatUtils.java,v 1.6 2003/08/06 21:13:39 ggregory Exp $
|
||||
*/
|
||||
public class DateFormatUtils {
|
||||
|
||||
|
@ -83,7 +84,7 @@ public class DateFormatUtils {
|
|||
* ISO8601 formatter for date-time with time zone.
|
||||
* The format used is <tt>yyyy-MM-dd'T'HH:mm:ssZZ</tt>.
|
||||
*/
|
||||
public static final FastDateFormat ISO_DATETIME_TIMEZONE_FORMAT
|
||||
public static final FastDateFormat ISO_DATETIME_TIME_ZONE_FORMAT
|
||||
= FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssZZ");
|
||||
|
||||
/**
|
||||
|
@ -99,7 +100,7 @@ public class DateFormatUtils {
|
|||
* This pattern does not comply with the formal ISO8601 specification
|
||||
* as the standard does not allow a time zone without a time.
|
||||
*/
|
||||
public static final FastDateFormat ISO_DATE_TIMEZONE_FORMAT
|
||||
public static final FastDateFormat ISO_DATE_TIME_ZONE_FORMAT
|
||||
= FastDateFormat.getInstance("yyyy-MM-ddZZ");
|
||||
|
||||
/**
|
||||
|
@ -113,7 +114,7 @@ public class DateFormatUtils {
|
|||
* ISO8601 formatter for time with time zone.
|
||||
* The format used is <tt>'T'HH:mm:ssZZ</tt>.
|
||||
*/
|
||||
public static final FastDateFormat ISO_TIME_TIMEZONE_FORMAT
|
||||
public static final FastDateFormat ISO_TIME_TIME_ZONE_FORMAT
|
||||
= FastDateFormat.getInstance("'T'HH:mm:ssZZ");
|
||||
|
||||
/**
|
||||
|
@ -131,7 +132,7 @@ public class DateFormatUtils {
|
|||
* This pattern does not comply with the formal ISO8601 specification
|
||||
* as the standard requires the 'T' prefix for times.
|
||||
*/
|
||||
public static final FastDateFormat ISO_TIME_NO_T_TIMEZONE_FORMAT
|
||||
public static final FastDateFormat ISO_TIME_NO_T_TIME_ZONE_FORMAT
|
||||
= FastDateFormat.getInstance("HH:mm:ssZZ");
|
||||
|
||||
/**
|
||||
|
@ -159,7 +160,7 @@ public class DateFormatUtils {
|
|||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(long millis, String pattern) {
|
||||
return format(new Date(millis), pattern, DateUtils.UTC_TIMEZONE, null);
|
||||
return format(new Date(millis), pattern, DateUtils.UTC_TIME_ZONE, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +171,7 @@ public class DateFormatUtils {
|
|||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(Date date, String pattern) {
|
||||
return format(date, pattern, DateUtils.UTC_TIMEZONE, null);
|
||||
return format(date, pattern, DateUtils.UTC_TIME_ZONE, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,7 +183,7 @@ public class DateFormatUtils {
|
|||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(long millis, String pattern, Locale locale) {
|
||||
return format(new Date(millis), pattern, DateUtils.UTC_TIMEZONE, locale);
|
||||
return format(new Date(millis), pattern, DateUtils.UTC_TIME_ZONE, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -194,7 +195,7 @@ public class DateFormatUtils {
|
|||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(Date date, String pattern, Locale locale) {
|
||||
return format(date, pattern, DateUtils.UTC_TIMEZONE, locale);
|
||||
return format(date, pattern, DateUtils.UTC_TIME_ZONE, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,15 +72,16 @@ import java.util.TimeZone;
|
|||
* @author <a href="mailto:sergek@lokitech.com">Serge Knystautas</a>
|
||||
* @author Stephen Colebourne
|
||||
* @author Janek Bogucki
|
||||
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
|
||||
* @since 2.0
|
||||
* @version $Id: DateUtils.java,v 1.9 2003/08/06 01:44:57 ggregory Exp $
|
||||
* @version $Id: DateUtils.java,v 1.10 2003/08/06 21:13:39 ggregory Exp $
|
||||
*/
|
||||
public class DateUtils {
|
||||
|
||||
/**
|
||||
* The UTC time zone (often referred to as GMT).
|
||||
*/
|
||||
public static final TimeZone UTC_TIMEZONE = TimeZone.getTimeZone("GMT");
|
||||
public static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone("GMT");
|
||||
/**
|
||||
* Number of milliseconds in a standard second.
|
||||
*/
|
||||
|
|
|
@ -70,6 +70,7 @@ import junit.textui.TestRunner;
|
|||
* @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a>
|
||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
|
||||
* @author Stephen Colebourne
|
||||
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
|
||||
*/
|
||||
public class DateFormatUtilsTest extends TestCase {
|
||||
|
||||
|
@ -112,12 +113,12 @@ public class DateFormatUtilsTest extends TestCase {
|
|||
assertEquals("2002-02-23T09:11:12", text);
|
||||
|
||||
text = DateFormatUtils.format(cal.getTime(),
|
||||
DateFormatUtils.ISO_DATETIME_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("2002-02-23T09:11:12-03:00", text);
|
||||
text = DateFormatUtils.format(cal.getTime().getTime(),
|
||||
DateFormatUtils.ISO_DATETIME_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("2002-02-23T09:11:12-03:00", text);
|
||||
text = DateFormatUtils.ISO_DATETIME_TIMEZONE_FORMAT.format(cal);
|
||||
text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);
|
||||
assertEquals("2002-02-23T09:11:12-03:00", text);
|
||||
}
|
||||
|
||||
|
@ -135,12 +136,12 @@ public class DateFormatUtilsTest extends TestCase {
|
|||
assertEquals("2002-02-23", text);
|
||||
|
||||
text = DateFormatUtils.format(cal.getTime(),
|
||||
DateFormatUtils.ISO_DATE_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("2002-02-23-03:00", text);
|
||||
text = DateFormatUtils.format(cal.getTime().getTime(),
|
||||
DateFormatUtils.ISO_DATE_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("2002-02-23-03:00", text);
|
||||
text = DateFormatUtils.ISO_DATE_TIMEZONE_FORMAT.format(cal);
|
||||
text = DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(cal);
|
||||
assertEquals("2002-02-23-03:00", text);
|
||||
}
|
||||
|
||||
|
@ -158,12 +159,12 @@ public class DateFormatUtilsTest extends TestCase {
|
|||
assertEquals("T10:11:12", text);
|
||||
|
||||
text = DateFormatUtils.format(cal.getTime(),
|
||||
DateFormatUtils.ISO_TIME_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("T10:11:12-03:00", text);
|
||||
text = DateFormatUtils.format(cal.getTime().getTime(),
|
||||
DateFormatUtils.ISO_TIME_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("T10:11:12-03:00", text);
|
||||
text = DateFormatUtils.ISO_TIME_TIMEZONE_FORMAT.format(cal);
|
||||
text = DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(cal);
|
||||
assertEquals("T10:11:12-03:00", text);
|
||||
}
|
||||
|
||||
|
@ -181,12 +182,12 @@ public class DateFormatUtilsTest extends TestCase {
|
|||
assertEquals("10:11:12", text);
|
||||
|
||||
text = DateFormatUtils.format(cal.getTime(),
|
||||
DateFormatUtils.ISO_TIME_NO_T_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("10:11:12-03:00", text);
|
||||
text = DateFormatUtils.format(cal.getTime().getTime(),
|
||||
DateFormatUtils.ISO_TIME_NO_T_TIMEZONE_FORMAT.getPattern(), timeZone);
|
||||
DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);
|
||||
assertEquals("10:11:12-03:00", text);
|
||||
text = DateFormatUtils.ISO_TIME_NO_T_TIMEZONE_FORMAT.format(cal);
|
||||
text = DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(cal);
|
||||
assertEquals("10:11:12-03:00", text);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ public class DurationFormatUtilsTest extends TestCase {
|
|||
cal.set(Calendar.MILLISECOND, 1);
|
||||
String text;
|
||||
// repeat a test from testDateTimeISO to compare extended and not extended.
|
||||
text = DateFormatUtils.ISO_DATETIME_TIMEZONE_FORMAT.format(cal);
|
||||
text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);
|
||||
assertEquals("2002-02-23T09:11:12-03:00", text);
|
||||
// test fixture is the same as above, but now with extended format.
|
||||
text = DurationFormatUtils.ISO_EXTENDED_FORMAT.format(cal);
|
||||
|
|
Loading…
Reference in New Issue