-//##header\r
-/*\r
- *******************************************************************************\r
- * Copyright (C) 2001-2009, International Business Machines Corporation and *\r
- * others. All Rights Reserved. *\r
- *******************************************************************************\r
- */\r
-\r
-/** \r
- * Port From: ICU4C v1.8.1 : format : DateFormatTest\r
- * Source File: $ICU4CRoot/source/test/intltest/dtfmttst.cpp\r
- **/\r
-\r
-package com.ibm.icu.dev.test.format;\r
-\r
-import java.text.AttributedCharacterIterator;\r
-import java.text.CharacterIterator;\r
-import java.text.FieldPosition;\r
-import java.text.ParseException;\r
-import java.text.ParsePosition;\r
-import java.util.Date;\r
-import java.util.Iterator;\r
-import java.util.Locale;\r
-import java.util.Map;\r
-import java.util.ResourceBundle;\r
-import java.util.Set;\r
-\r
-import com.ibm.icu.impl.ICUResourceBundle;\r
-import com.ibm.icu.text.ChineseDateFormat;\r
-import com.ibm.icu.text.ChineseDateFormatSymbols;\r
-import com.ibm.icu.text.DateFormat;\r
-import com.ibm.icu.text.DateFormatSymbols;\r
-import com.ibm.icu.text.NumberFormat;\r
-import com.ibm.icu.text.SimpleDateFormat;\r
-import com.ibm.icu.util.BuddhistCalendar;\r
-import com.ibm.icu.util.Calendar;\r
-import com.ibm.icu.util.ChineseCalendar;\r
-import com.ibm.icu.util.GregorianCalendar;\r
-import com.ibm.icu.util.HebrewCalendar;\r
-import com.ibm.icu.util.IslamicCalendar;\r
-import com.ibm.icu.util.JapaneseCalendar;\r
-import com.ibm.icu.util.TimeZone;\r
-import com.ibm.icu.util.ULocale;\r
-import com.ibm.icu.util.UResourceBundle;\r
-import com.ibm.icu.util.VersionInfo;\r
-\r
-public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {\r
- \r
- public static void main(String[] args) throws Exception {\r
- new DateFormatTest().run(args);\r
- }\r
-\r
- /**\r
- * Verify that patterns have the correct values and could produce the \r
- * the DateFormat instances that contain the correct localized patterns.\r
- */\r
- public void TestPatterns() {\r
- final String[][] EXPECTED = {\r
- {DateFormat.MINUTE_SECOND, "ms", "en", "m:s"},\r
- {DateFormat.HOUR24_MINUTE, "Hm", "en", "H:m"},\r
- {DateFormat.HOUR24_MINUTE_SECOND, "Hms","en","H:m:s"},\r
- {DateFormat.HOUR_MINUTE, "hm","en","h:m a"},\r
- {DateFormat.HOUR_MINUTE_SECOND, "hms","en","h:m:s a"},\r
- {DateFormat.DAY, "d","en","d"},\r
- {DateFormat.STANDALONE_MONTH, "LLLL","en","LLLL"},\r
- {DateFormat.ABBR_STANDALONE_MONTH, "LLL","en","LLL"},\r
- {DateFormat.YEAR, "y","en","y"},\r
- {DateFormat.MONTH_DAY, "MMMMd","en","MMMM d"},\r
- {DateFormat.ABBR_MONTH_DAY, "MMMd","en","MMM d"},\r
- {DateFormat.NUM_MONTH_DAY, "Md","en","M/d"},\r
- {DateFormat.MONTH_WEEKDAY_DAY, "MMMMEEEEd","en","EEEE, MMMM d"},\r
- {DateFormat.ABBR_MONTH_WEEKDAY_DAY, "MMMEd","en","E, MMM d"},\r
- {DateFormat.NUM_MONTH_WEEKDAY_DAY, "MEd","en","E, M/d"},\r
- {DateFormat.YEAR_MONTH, "yMMMM","en","MMMM y"},\r
- {DateFormat.YEAR_ABBR_MONTH, "yMMM","en","MMM y"},\r
- {DateFormat.YEAR_NUM_MONTH, "yM","en","M/y"}, \r
- {DateFormat.YEAR_ABBR_MONTH_WEEKDAY_DAY, "yMMMEd", "en", "E, MMM d, y"},\r
- {DateFormat.YEAR_NUM_MONTH_WEEKDAY_DAY, "yMEd", "en", "E, M/d/y"},\r
- {DateFormat.YEAR_QUARTER, "yQQQ", "en", "QQQ y"},\r
- {DateFormat.YEAR_ABBR_QUARTER, "yQ", "en", "Q y"}\r
- };\r
- \r
- for (int i = 0; i < EXPECTED.length; i++) {\r
- \r
- // Verify that patterns have the correct values\r
- String actualPattern = EXPECTED[i][0];\r
- String expectedPattern = EXPECTED[i][1];\r
- ULocale locale = new ULocale(EXPECTED[i][2], "", "");\r
- if (!actualPattern.equals(expectedPattern)) {\r
- errln("FAILURE! Expected pattern: " + expectedPattern + \r
- " but was: " + actualPattern);\r
- }\r
- \r
- // Verify that DataFormat instances produced contain the correct \r
- // localized patterns\r
- DateFormat date1 = DateFormat.getPatternInstance(actualPattern, \r
- locale);\r
- DateFormat date2 = DateFormat.getPatternInstance(Calendar.getInstance(locale),\r
- actualPattern, locale);\r
- \r
- String expectedLocalPattern = EXPECTED[i][3];\r
- String actualLocalPattern1 = ((SimpleDateFormat)date1).toLocalizedPattern();\r
- String actualLocalPattern2 = ((SimpleDateFormat)date2).toLocalizedPattern();\r
- if (!actualLocalPattern1.equals(expectedLocalPattern)) {\r
- errln("FAILURE! Expected local pattern: " + expectedLocalPattern \r
- + " but was: " + actualLocalPattern1);\r
- } \r
- if (!actualLocalPattern2.equals(expectedLocalPattern)) {\r
- errln("FAILURE! Expected local pattern: " + expectedLocalPattern \r
- + " but was: " + actualLocalPattern2);\r
- } \r
- }\r
- }\r
-\r
- // Test written by Wally Wedel and emailed to me.\r
- public void TestWallyWedel() {\r
- /*\r
- * Instantiate a TimeZone so we can get the ids.\r
- */\r
- //TimeZone tz = new SimpleTimeZone(7, ""); //The variable is never used\r
- /*\r
- * Computational variables.\r
- */\r
- int offset, hours, minutes, seconds;\r
- /*\r
- * Instantiate a SimpleDateFormat set up to produce a full time\r
- zone name.\r
- */\r
- SimpleDateFormat sdf = new SimpleDateFormat("zzzz");\r
- /*\r
- * A String array for the time zone ids.\r
- */\r
- \r
- final String[] ids = TimeZone.getAvailableIDs();\r
- int ids_length = ids.length; //when fixed the bug should comment it out\r
- \r
- /*\r
- * How many ids do we have?\r
- */\r
- logln("Time Zone IDs size:" + ids_length);\r
- /*\r
- * Column headings (sort of)\r
- */\r
- logln("Ordinal ID offset(h:m) name");\r
- /*\r
- * Loop through the tzs.\r
- */\r
- Date today = new Date();\r
- Calendar cal = Calendar.getInstance();\r
- for (int i = 0; i < ids_length; i++) {\r
- logln(i + " " + ids[i]);\r
- TimeZone ttz = TimeZone.getTimeZone(ids[i]);\r
- // offset = ttz.getRawOffset();\r
- cal.setTimeZone(ttz);\r
- cal.setTime(today);\r
- offset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET);\r
- // logln(i + " " + ids[i] + " offset " + offset);\r
- String sign = "+";\r
- if (offset < 0) {\r
- sign = "-";\r
- offset = -offset;\r
- }\r
- hours = offset / 3600000;\r
- minutes = (offset % 3600000) / 60000;\r
- seconds = (offset % 60000) / 1000;\r
- String dstOffset = sign + (hours < 10 ? "0" : "") + hours\r
- + ":" + (minutes < 10 ? "0" : "") + minutes; \r
- if (seconds != 0) {\r
- dstOffset += ":" + (seconds < 10 ? "0" : "") + seconds;\r
- }\r
- /*\r
- * Instantiate a date so we can display the time zone name.\r
- */\r
- sdf.setTimeZone(ttz);\r
- /*\r
- * Format the output.\r
- */\r
- StringBuffer fmtOffset = new StringBuffer("");\r
- FieldPosition pos = new FieldPosition(0);\r
- \r
- try {\r
- fmtOffset = sdf.format(today, fmtOffset, pos);\r
- } catch (Exception e) { \r
- logln("Exception:" + e);\r
- continue;\r
- }\r
- // UnicodeString fmtOffset = tzS.toString();\r
- String fmtDstOffset = null;\r
- if (fmtOffset.toString().startsWith("GMT")) {\r
- //fmtDstOffset = fmtOffset.substring(3);\r
- fmtDstOffset = fmtOffset.substring(3, fmtOffset.length());\r
- }\r
- /*\r
- * Show our result.\r
- */\r
- \r
- boolean ok = fmtDstOffset == null || fmtDstOffset.equals("") || fmtDstOffset.equals(dstOffset);\r
- if (ok) {\r
- logln(i + " " + ids[i] + " " + dstOffset + " "\r
- + fmtOffset + (fmtDstOffset != null ? " ok" : " ?")); \r
- } else {\r
- errln(i + " " + ids[i] + " " + dstOffset + " " + fmtOffset + " *** FAIL ***");\r
- }\r
- \r
- }\r
- }\r
- \r
- public void TestEquals() {\r
- DateFormat fmtA = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL); \r
- DateFormat fmtB = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL); \r
- if (!fmtA.equals(fmtB))\r
- errln("FAIL"); \r
- }\r
- \r
- /**\r
- * Test the parsing of 2-digit years.\r
- */\r
- public void TestTwoDigitYearDSTParse() {\r
- \r
- SimpleDateFormat fullFmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss.SSS zzz yyyy G"); \r
- SimpleDateFormat fmt = new SimpleDateFormat("dd-MMM-yy h:mm:ss 'o''clock' a z", Locale.ENGLISH); \r
- String s = "03-Apr-04 2:20:47 o'clock AM PST";\r
- \r
- /*\r
- * SimpleDateFormat(pattern, locale) Construct a SimpleDateDateFormat using\r
- * the given pattern, the locale and using the TimeZone.getDefault();\r
- * So it need to add the timezone offset on hour field. \r
- * ps. the Method Calendar.getTime() used by SimpleDateFormat.parse() always \r
- * return Date value with TimeZone.getDefault() [Richard/GCL]\r
- */\r
- \r
- TimeZone defaultTZ = TimeZone.getDefault();\r
- TimeZone PST = TimeZone.getTimeZone("PST");\r
- int defaultOffset = defaultTZ.getRawOffset();\r
- int PSTOffset = PST.getRawOffset();\r
- int hour = 2 + (defaultOffset - PSTOffset) / (60*60*1000);\r
- // hour is the expected hour of day, in units of seconds\r
- hour = ((hour < 0) ? hour + 24 : hour) * 60*60;\r
- try {\r
- Date d = fmt.parse(s);\r
- Calendar cal = Calendar.getInstance();\r
- cal.setTime(d);\r
- //DSTOffset\r
- hour += defaultTZ.inDaylightTime(d) ? 1 : 0;\r
- \r
- logln(s + " P> " + ((DateFormat) fullFmt).format(d));\r
- // hr is the actual hour of day, in units of seconds\r
- // adjust for DST\r
- int hr = cal.get(Calendar.HOUR_OF_DAY) * 60*60 -\r
- cal.get(Calendar.DST_OFFSET) / 1000;\r
- if (hr != hour)\r
- errln("FAIL: Hour (-DST) = " + hr / (60*60.0)+\r
- "; expected " + hour / (60*60.0));\r
- } catch (ParseException e) {\r
- errln("Parse Error:" + e.getMessage());\r
- }\r
- \r
- }\r
- \r
- /**\r
- * Verify that returned field position indices are correct.\r
- */\r
- public void TestFieldPosition() {\r
- int i, j, exp;\r
- StringBuffer buf = new StringBuffer();\r
-\r
- // Verify data\r
- if (VersionInfo.ICU_VERSION.compareTo(VersionInfo.getInstance(3, 7)) >= 0) {\r
- DateFormatSymbols rootSyms = new DateFormatSymbols(new Locale("", "", ""));\r
- assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars());\r
- }\r
- \r
- assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES.length == DateFormat.FIELD_COUNT);\r
- if(DateFormat.FIELD_COUNT != PATTERN_CHARS.length()){\r
- errln("Did not get the correct value for DateFormat.FIELD_COUNT. Expected: "+ PATTERN_CHARS.length());\r
- }\r
-\r
- // Create test formatters\r
- final int COUNT = 4;\r
- DateFormat[] dateFormats = new DateFormat[COUNT];\r
- dateFormats[0] = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US);\r
- dateFormats[1] = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.FRANCE);\r
- // Make the pattern "G y M d..."\r
- buf.append(PATTERN_CHARS);\r
- for (j=buf.length()-1; j>=0; --j) buf.insert(j, ' ');\r
- dateFormats[2] = new SimpleDateFormat(buf.toString(), Locale.US);\r
- // Make the pattern "GGGG yyyy MMMM dddd..."\r
- for (j=buf.length()-1; j>=0; j-=2) {\r
- for (i=0; i<3; ++i) {\r
- buf.insert(j, buf.charAt(j));\r
- }\r
- }\r
- dateFormats[3] = new SimpleDateFormat(buf.toString(), Locale.US);\r
-\r
- Date aug13 = new Date((long) 871508052513.0);\r
-\r
- // Expected output field values for above DateFormats on aug13\r
- // Fields are given in order of DateFormat field number\r
- final String EXPECTED[] = {\r
- "", "1997", "August", "13", "", "", "34", "12", "",\r
- "Wednesday", "", "", "", "", "PM", "2", "", "Pacific Daylight Time", "", "", "", "", "", "", "","","","","","",\r
-\r
- "", "1997", "ao\u00FBt", "13", "", "14", "34", "12", "",\r
- "mercredi", "", "", "", "", "", "", "", "heure avanc\u00E9e du Pacifique", "", "", "", "", "", "", "","","","","","",\r
-\r
- "AD", "1997", "8", "13", "14", "14", "34", "12", "5",\r
- "Wed", "225", "2", "33", "2", "PM", "2", "2", "PDT", "1997", "4", "1997", "2450674", "52452513", "-0700", "PT","4","8","3","3","PDT",\r
-\r
- "Anno Domini", "1997", "August", "0013", "0014", "0014", "0034", "0012", "5130",\r
- "Wednesday", "0225", "0002", "0033", "0002", "PM", "0002", "0002", "Pacific Daylight Time", "1997",\r
- "Wednesday", "1997", "2450674", "52452513", "GMT-07:00", "Pacific Time","Wednesday","August", "3rd quarter", "3rd quarter","United States (Los Angeles)",\r
- };\r
-\r
- assertTrue("data size", EXPECTED.length == COUNT * DateFormat.FIELD_COUNT);\r
-\r
-//#if defined(FOUNDATION10) || defined(J2SE13)\r
-//#else\r
- final DateFormat.Field[] DTFMT_FIELDS = {\r
- DateFormat.Field.AM_PM,\r
- DateFormat.Field.DAY_OF_MONTH,\r
- DateFormat.Field.DAY_OF_WEEK,\r
- DateFormat.Field.DAY_OF_WEEK_IN_MONTH,\r
- DateFormat.Field.DAY_OF_YEAR,\r
-\r
- DateFormat.Field.DOW_LOCAL,\r
- DateFormat.Field.ERA,\r
- DateFormat.Field.EXTENDED_YEAR,\r
- DateFormat.Field.HOUR_OF_DAY0,\r
- DateFormat.Field.HOUR_OF_DAY1,\r
-\r
- DateFormat.Field.HOUR0,\r
- DateFormat.Field.HOUR1,\r
- DateFormat.Field.JULIAN_DAY,\r
- DateFormat.Field.MILLISECOND,\r
- DateFormat.Field.MILLISECONDS_IN_DAY,\r
-\r
- DateFormat.Field.MINUTE,\r
- DateFormat.Field.MONTH,\r
- DateFormat.Field.QUARTER,\r
- DateFormat.Field.SECOND,\r
- DateFormat.Field.TIME_ZONE,\r
-\r
- DateFormat.Field.WEEK_OF_MONTH,\r
- DateFormat.Field.WEEK_OF_YEAR,\r
- DateFormat.Field.YEAR,\r
- DateFormat.Field.YEAR_WOY,\r
- };\r
-\r
- final String[][] EXPECTED_BY_FIELD = {\r
- {"PM", "13", "Wednesday", "", "",\r
- "", "", "", "", "",\r
- "", "2", "", "", "",\r
- "34", "August", "", "12", "Pacific Daylight Time",\r
- "", "", "1997", ""},\r
-\r
- {"", "13", "mercredi", "", "",\r
- "", "", "", "14", "",\r
- "", "", "", "", "",\r
- "34", "ao\u00FBt", "", "12", "heure avanc\u00E9e du Pacifique",\r
- "", "", "1997", ""},\r
-\r
- {"PM", "13", "Wed", "2", "225",\r
- "4", "AD", "1997", "14", "14",\r
- "2", "2", "2450674", "5", "52452513",\r
- "34", "8", "3", "12", "PDT",\r
- "2", "33", "1997", "1997"},\r
-\r
- {"PM", "0013", "Wednesday", "0002", "0225",\r
- "Wednesday", "Anno Domini", "1997", "0014", "0014",\r
- "0002", "0002", "2450674", "5130", "52452513",\r
- "0034", "August", "3rd quarter", "0012", "Pacific Daylight Time",\r
- "0002", "0033", "1997", "1997"},\r
- };\r
-//#endif\r
-\r
- TimeZone PT = TimeZone.getTimeZone("America/Los_Angeles");\r
- for (j = 0, exp = 0; j < COUNT; ++j) {\r
- // String str;\r
- DateFormat df = dateFormats[j];\r
- df.setTimeZone(PT);\r
- logln(" Pattern = " + ((SimpleDateFormat) df).toPattern());\r
- try {\r
- logln(" Result = " + df.format(aug13));\r
- } catch (Exception e) {\r
- errln("FAIL: " + e);\r
- e.printStackTrace();\r
- continue;\r
- }\r
-\r
- FieldPosition pos;\r
- String field;\r
-\r
- for (i = 0; i < DateFormat.FIELD_COUNT; ++i, ++exp) {\r
- pos = new FieldPosition(i);\r
- buf.setLength(0);\r
- df.format(aug13, buf, pos); \r
- field = buf.substring(pos.getBeginIndex(), pos.getEndIndex());\r
- assertEquals("pattern#" + j + " field #" + i + " " + DATEFORMAT_FIELD_NAMES[i],\r
- EXPECTED[exp], field);\r
- }\r
-\r
-//#if defined(FOUNDATION10) || defined(J2SE13)\r
-//#else\r
- // FieldPostion initialized by DateFormat.Field trac#6089\r
- for(i = 0; i < DTFMT_FIELDS.length; i++) {\r
- // The format method only set position for the first occurrence of\r
- // the specified field.\r
- pos = new FieldPosition(DTFMT_FIELDS[i]);\r
- buf.setLength(0);\r
- df.format(aug13, buf, pos);\r
- field = buf.substring(pos.getBeginIndex(), pos.getEndIndex());\r
- assertEquals("pattern#" + j + " " + DTFMT_FIELDS[i].toString(), EXPECTED_BY_FIELD[j][i], field);\r
- }\r
-//#endif\r
- }\r
- }\r
- /**\r
- * This MUST be kept in sync with DateFormatSymbols.patternChars.\r
- */\r
- static final String PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqV";\r
-\r
-//#if defined(FOUNDATION10) || defined(J2SE13)\r
-//#else\r
- /**\r
- * A list of the DateFormat.Field.\r
- * This MUST be kept in sync with PATTERN_CHARS above.\r
- */\r
- static final DateFormat.Field[] DATEFORMAT_FIELDS = {\r
- DateFormat.Field.ERA, // G\r
- DateFormat.Field.YEAR, // y\r
- DateFormat.Field.MONTH, // M\r
- DateFormat.Field.DAY_OF_MONTH, // d\r
- DateFormat.Field.HOUR_OF_DAY1, // k\r
- DateFormat.Field.HOUR_OF_DAY0, // H\r
- DateFormat.Field.MINUTE, // m\r
- DateFormat.Field.SECOND, // s\r
- DateFormat.Field.MILLISECOND, // S\r
- DateFormat.Field.DAY_OF_WEEK, // E\r
- DateFormat.Field.DAY_OF_YEAR, // D\r
- DateFormat.Field.DAY_OF_WEEK_IN_MONTH, // F\r
- DateFormat.Field.WEEK_OF_YEAR, // w\r
- DateFormat.Field.WEEK_OF_MONTH, // W\r
- DateFormat.Field.AM_PM, // a\r
- DateFormat.Field.HOUR1, // h\r
- DateFormat.Field.HOUR0, // K\r
- DateFormat.Field.TIME_ZONE, // z\r
- DateFormat.Field.YEAR_WOY, // Y\r
- DateFormat.Field.DOW_LOCAL, // e\r
- DateFormat.Field.EXTENDED_YEAR, // u\r
- DateFormat.Field.JULIAN_DAY, // g\r
- DateFormat.Field.MILLISECONDS_IN_DAY, // A\r
- DateFormat.Field.TIME_ZONE, // Z\r
- DateFormat.Field.TIME_ZONE, // v\r
- DateFormat.Field.DAY_OF_WEEK, // c\r
- DateFormat.Field.MONTH, // L\r
- DateFormat.Field.QUARTER, // Q\r
- DateFormat.Field.QUARTER, // q\r
- DateFormat.Field.TIME_ZONE, // V\r
- };\r
-//#endif\r
-\r
- /**\r
- * A list of the names of all the fields in DateFormat.\r
- * This MUST be kept in sync with DateFormat.\r
- */\r
- static final String DATEFORMAT_FIELD_NAMES[] = {\r
- "ERA_FIELD",\r
- "YEAR_FIELD",\r
- "MONTH_FIELD",\r
- "DATE_FIELD",\r
- "HOUR_OF_DAY1_FIELD",\r
- "HOUR_OF_DAY0_FIELD",\r
- "MINUTE_FIELD",\r
- "SECOND_FIELD",\r
- "MILLISECOND_FIELD",\r
- "DAY_OF_WEEK_FIELD",\r
- "DAY_OF_YEAR_FIELD",\r
- "DAY_OF_WEEK_IN_MONTH_FIELD",\r
- "WEEK_OF_YEAR_FIELD",\r
- "WEEK_OF_MONTH_FIELD",\r
- "AM_PM_FIELD",\r
- "HOUR1_FIELD",\r
- "HOUR0_FIELD",\r
- "TIMEZONE_FIELD",\r
- "YEAR_WOY_FIELD",\r
- "DOW_LOCAL_FIELD",\r
- "EXTENDED_YEAR_FIELD",\r
- "JULIAN_DAY_FIELD",\r
- "MILLISECONDS_IN_DAY_FIELD",\r
- "TIMEZONE_RFC_FIELD",\r
- "GENERIC_TIMEZONE_FIELD",\r
- "STAND_ALONE_DAY_FIELD",\r
- "STAND_ALONE_MONTH_FIELD",\r
- "QUARTER_FIELD",\r
- "STAND_ALONE_QUARTER_FIELD",\r
- "TIMEZONE_SPECIAL_FIELD",\r
- };\r
-\r
- /**\r
- * General parse/format tests. Add test cases as needed.\r
- */\r
- public void TestGeneral() {\r
- \r
- String DATA[] = {\r
- "yyyy MM dd HH:mm:ss.SSS",\r
-\r
- // Milliseconds are left-justified, since they format as fractions of a second\r
- // Both format and parse should round HALF_UP\r
- "y/M/d H:mm:ss.S", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.6", "2004 03 10 16:36:31.600",\r
- "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.57", "2004 03 10 16:36:31.570",\r
- "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567",\r
- "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.568", "2004/3/10 16:36:31.5680",\r
- };\r
- expect(DATA, new Locale("en", "", ""));\r
- }\r
-\r
- public void TestGenericTime() {\r
-\r
-\r
- // any zone pattern should parse any zone\r
- Locale en = new Locale("en", "", "");\r
- String ZDATA[] = {\r
- "yyyy MM dd HH:mm zzz",\r
- // round trip\r
- "y/M/d H:mm zzzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Standard Time",\r
- "y/M/d H:mm zzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",\r
- "y/M/d H:mm vvvv", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",\r
- "y/M/d H:mm v", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PT",\r
- // non-generic timezone string influences dst offset even if wrong for date/time\r
- "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 PST",\r
- "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 Pacific Time",\r
- "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 PDT",\r
- "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 Pacific Time",\r
- // generic timezone generates dst offset appropriate for local time\r
- "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",\r
- "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",\r
- "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT",\r
- "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time",\r
- // daylight savings time transition edge cases.\r
- // time to parse does not really exist, PT interpreted as earlier time\r
- "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT",\r
- "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT",\r
- "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PST",\r
- "y/M/d H:mm v", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT",\r
- "y/M/d H:mm v", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT",\r
- "y/M/d H:mm v", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PT",\r
- "y/M/d H:mm", "pf", "2005/4/3 2:30", "2005 04 03 03:30 PDT", "2005/4/3 3:30",\r
- // time to parse is ambiguous, PT interpreted as later time\r
- "y/M/d H:mm zzz", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PST",\r
- "y/M/d H:mm v", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PT",\r
- "y/M/d H:mm", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30",\r
-\r
- "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST",\r
- "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST",\r
- "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PDT",\r
- "y/M/d H:mm v", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT",\r
- "y/M/d H:mm v", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT",\r
- "y/M/d H:mm v", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PT",\r
- "y/M/d H:mm", "pf", "2004/10/31 1:30", "2004 10 31 01:30 PST", "2004/10/31 1:30",\r
- // Below is actually an invalid test case. See the note in #5910. Disable the case for now.\r
- // TODO: Revisit after 3.8\r
- //"y/M/d H:mm vvvv", "pf", "2004/10/31 1:30 Argentina Time", "2004 10 30 21:30 PDT", "2004/10/31 1:30 Argentina Time",\r
- };\r
- expect(ZDATA, en);\r
-\r
- logln("cross format/parse tests");\r
- final String basepat = "yy/MM/dd H:mm ";\r
- final SimpleDateFormat[] formats = { \r
- new SimpleDateFormat(basepat + "v", en),\r
- new SimpleDateFormat(basepat + "vvvv", en),\r
- new SimpleDateFormat(basepat + "zzz", en),\r
- new SimpleDateFormat(basepat + "zzzz", en)\r
- };\r
-\r
- final SimpleDateFormat univ = new SimpleDateFormat("yyyy MM dd HH:mm zzz", en);\r
- final String[] times = { "2004 01 02 03:04 PST", "2004 07 08 09:10 PDT" };\r
- for (int i = 0; i < times.length; ++i) {\r
- try {\r
- Date d = univ.parse(times[i]);\r
- logln("time: " + d);\r
- for (int j = 0; j < formats.length; ++j) {\r
- String test = formats[j].format(d);\r
- logln("test: '" + test + "'");\r
- for (int k = 0; k < formats.length; ++k) {\r
- try {\r
- Date t = formats[k].parse(test);\r
- if (!d.equals(t)) {\r
- errln("format " + k + \r
- " incorrectly parsed output of format " + j + \r
- " (" + test + "), returned " +\r
- t + " instead of " + d);\r
- } else {\r
- logln("format " + k + " parsed ok");\r
- }\r
- }\r
- catch (ParseException e) {\r
- errln("format " + k + \r
- " could not parse output of format " + j + \r
- " (" + test + ")");\r
- }\r
- }\r
- }\r
- }\r
- catch (ParseException e) {\r
- errln("univ could not parse: " + times[i]);\r
- }\r
- }\r
-\r
- }\r
-\r
- public void TestGenericTimeZoneOrder() {\r
- // generic times should parse the same no matter what the placement of the time zone string\r
- // should work for standard and daylight times\r
-\r
- String XDATA[] = {\r
- "yyyy MM dd HH:mm zzz",\r
- // standard time, explicit daylight/standard\r
- "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",\r
- "y/M/d zzz H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 PST 1:00",\r
- "zzz y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "PST 2004/1/1 1:00",\r
-\r
- // standard time, generic\r
- "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",\r
- "y/M/d vvvv H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 Pacific Time 1:00",\r
- "vvvv y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "Pacific Time 2004/1/1 1:00",\r
-\r
- // daylight time, explicit daylight/standard\r
- "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT",\r
- "y/M/d zzz H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 PDT 1:00",\r
- "zzz y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "PDT 2004/7/1 1:00",\r
-\r
- // daylight time, generic\r
- "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time",\r
- "y/M/d vvvv H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 Pacific Time 1:00",\r
- "vvvv y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "Pacific Time 2004/7/1 1:00",\r
- };\r
- Locale en = new Locale("en", "", "");\r
- expect(XDATA, en);\r
- }\r
-\r
- public void TestTimeZoneDisplayName() {\r
- Calendar cal = new GregorianCalendar();\r
- SimpleDateFormat testfmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");\r
-\r
- for (int i = 0; i < fallbackTests.length; ++i) {\r
- String[] info = fallbackTests[i];\r
- logln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3]);\r
-\r
- long time = 0;\r
- try {\r
- Date testd = testfmt.parse(info[2]);\r
- time = testd.getTime();\r
- } catch (ParseException pe) {\r
- errln("Failed to parse test date data");\r
- continue;\r
- }\r
- ULocale l = new ULocale(info[0]);\r
- TimeZone tz = TimeZone.getTimeZone(info[1]);\r
- SimpleDateFormat fmt = new SimpleDateFormat(info[3], l);\r
- cal.setTimeInMillis(time);\r
- cal.setTimeZone(tz);\r
- String result = fmt.format(cal);\r
- if (!result.equals(info[4])) {\r
- errln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3] + " expected: '" + \r
- info[4] + "' but got: '" + result + "'");\r
- }\r
- }\r
- }\r
-\r
- private static final String GMT_BG = "\u0413\u0440\u0438\u0438\u043D\u0443\u0438\u0447";\r
- private static final String GMT_ZH = "\u683C\u6797\u5C3C\u6CBB\u6807\u51C6\u65F6\u95F4";\r
- //private static final String GMT_BG = "GMT";\r
-\r
- private static final String[][] fallbackTests = {\r
- { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },\r
- { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },\r
- { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "Pacific Standard Time", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "Pacific Daylight Time", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Pacific Time", "America/Los_Angeles" },\r
- { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "United States (Los Angeles)", "America/Los_Angeles" },\r
- { "en_GB", "America/Los_Angeles", "2004-01-15T12:00:00Z", "z", "PST", "America/Los_Angeles" },\r
- { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },\r
- { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "z", "MST", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "V", "MST", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "z", "MST", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "V", "MST", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "v", "MST", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "vvvv", "Mountain Standard Time", "America/Phoenix" },\r
- { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "VVVV", "United States (Phoenix)", "America/Phoenix" },\r
-\r
- { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },\r
- { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },\r
-\r
- { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },\r
- { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },\r
-\r
- { "en", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },\r
- { "en", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },\r
- { "en", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },\r
- { "en", "America/Havana", "2004-01-15T00:00:00Z", "V", "CST (Cuba)", "-5:00" },\r
- { "en", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "Cuba Standard Time", "-5:00" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "V", "CDT (Cuba)", "-4:00" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "Cuba Daylight Time", "-4:00" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "v", "Cuba Time", "America/Havana" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Cuba Time", "America/Havana" },\r
- { "en", "America/Havana", "2004-07-15T00:00:00Z", "VVVV", "Cuba Time", "America/Havana" },\r
-\r
- { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },\r
- { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },\r
- { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },\r
-\r
- { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },\r
- { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },\r
- { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },\r
-\r
- { "en", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },\r
- { "en", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },\r
- { "en", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" },\r
- { "en", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },\r
- { "en", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "Greenwich Mean Time", "+0:00" },\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "Europe/London" },\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "Europe/London" },\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "British Summer Time", "Europe/London" },\r
- // icu en.txt has exemplar city for this time zone\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "v", "United Kingdom Time", "Europe/London" },\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "United Kingdom Time", "Europe/London" },\r
- { "en", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "United Kingdom Time", "Europe/London" },\r
-\r
- { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },\r
- { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },\r
-\r
- // JB#5150\r
- { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "V", "IST", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },\r
- { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "V", "IST", "+05:30" },\r
- { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },\r
- { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "India Time", "Asia/Calcutta" },\r
- { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "India Standard Time", "Asia/Calcutta" },\r
- \r
- // ==========\r
-\r
- { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },\r
- { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },\r
- { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },\r
- { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },\r
- { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },\r
- { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },\r
- { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },\r
- { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },\r
- { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },\r
-\r
- { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },\r
- { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },\r
-\r
- { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },\r
- { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },\r
-\r
- { "de", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },\r
- { "de", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },\r
- { "de", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },\r
- { "de", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },\r
- { "de", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },\r
- { "de", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },\r
- { "de", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },\r
- { "de", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },\r
- { "de", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba", "America/Havana" },\r
- { "de", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kuba", "America/Havana" },\r
- // added to test proper fallback of country name\r
- { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba", "America/Havana" },\r
- { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kuba", "America/Havana" },\r
-\r
- { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },\r
- { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },\r
- { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },\r
- { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },\r
-\r
- { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },\r
- { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },\r
- { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },\r
- { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },\r
-\r
- { "de", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },\r
- { "de", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },\r
- { "de", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },\r
- { "de", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },\r
- { "de", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },\r
- { "de", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },\r
- { "de", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },\r
- { "de", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },\r
- { "de", "Europe/London", "2004-07-15T00:00:00Z", "v", "Vereinigtes K\u00f6nigreich", "Europe/London" },\r
- { "de", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "Vereinigtes K\u00f6nigreich", "Europe/London" },\r
-\r
- { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },\r
- { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },\r
-\r
- // JB#5150\r
- { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },\r
- { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },\r
- { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },\r
- { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },\r
- { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "Indien", "Asia/Calcutta" },\r
- { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "Indien", "Asia/Calcutta" },\r
-\r
- // ==========\r
-\r
- { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },\r
- { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0800", "-8:00" },\r
- { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0800", "America/Los_Angeles" },\r
- { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4", "America/Los_Angeles" },\r
- { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0700", "-7:00" },\r
- { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0700", "America/Los_Angeles" },\r
- { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4", "America/Los_Angeles" },\r
- // icu zh.txt has exemplar city for this time zone\r
- { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u7f8e\u56fd (\u6d1b\u6749\u77f6)", "America/Los_Angeles" },\r
- { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u7f8e\u56fd\u592a\u5e73\u6d0b\u65f6\u95f4", "America/Los_Angeles" },\r
-\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },\r
- // icu zh.txt does not have info for this time zone\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u963f\u6839\u5ef7 (\u5e03\u5b9c\u8bfa\u65af\u827e\u5229\u65af)", "America/Buenos_Aires" },\r
- { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "America/Buenos_Aires" },\r
-\r
- { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },\r
- { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u963f\u6839\u5ef7 (\u5e03\u5b9c\u8bfa\u65af\u827e\u5229\u65af)", "America/Buenos_Aires" },\r
- { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "America/Buenos_Aires" },\r
-\r
- { "zh", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },\r
- { "zh", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0500", "-5:00" },\r
- { "zh", "America/Havana", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0500", "-5:00" },\r
- { "zh", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\u53e4\u5df4\u6807\u51c6\u65f6\u95f4", "-5:00" },\r
- { "zh", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },\r
- { "zh", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0400", "-4:00" },\r
- { "zh", "America/Havana", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0400", "-4:00" },\r
- { "zh", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\u53e4\u5df4\u590f\u4ee4\u65f6\u95f4", "-4:00" },\r
- { "zh", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u53e4\u5df4\u65f6\u95f4", "America/Havana" },\r
- { "zh", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u53e4\u5df4\u65f6\u95f4", "America/Havana" },\r
-\r
- { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1100", "+11:00" },\r
- { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+1100", "+11:00" },\r
- { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u590f\u4ee4\u65f6\u95f4", "+11:00" },\r
- { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1000", "+10:00" },\r
- { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+1000", "+10:00" },\r
- { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4", "+10:00" },\r
- { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u6fb3\u5927\u5229\u4e9a (\u6089\u5c3c)", "Australia/Sydney" },\r
- { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u65f6\u95f4", "Australia/Sydney" },\r
-\r
- { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1100", "+11:00" },\r
- { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+1100", "+11:00" },\r
- { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u590f\u4ee4\u65f6\u95f4", "+11:00" },\r
- { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1000", "+10:00" },\r
- { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+1000", "+10:00" },\r
- { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4", "+10:00" },\r
- { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u6fb3\u5927\u5229\u4e9a (\u6089\u5c3c)", "Australia/Sydney" },\r
- { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u65f6\u95f4", "Australia/Sydney" },\r
-\r
- { "zh", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },\r
- { "zh", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0000", "+0:00" },\r
- { "zh", "Europe/London", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+0000", "+0:00" },\r
- { "zh", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },\r
- { "zh", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\u683C\u6797\u5C3C\u6CBB\u6807\u51C6\u65F6\u95F4", "+0:00" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0100", "+1:00" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+0100", "+1:00" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "+1:00" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", GMT_ZH+"+0100", "+1:00" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u82f1\u56fd\u65f6\u95f4", "Europe/London" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u82f1\u56fd\u65f6\u95f4", "Europe/London" },\r
- { "zh", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\u82f1\u56fd\u65f6\u95f4", "Europe/London" },\r
-\r
- { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", GMT_ZH+"-0300", "-3:00" },\r
- { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", GMT_ZH+"-0300", "-3:00" },\r
-\r
- // JB#5150\r
- { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0530", "+5:30" },\r
- { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+0530", "+5:30" },\r
- { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\u5370\u5ea6\u6807\u51c6\u65f6\u95f4", "+5:30" },\r
- { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0530", "+5:30" },\r
- { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+0530", "+05:30" },\r
- { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\u5370\u5ea6\u6807\u51c6\u65f6\u95f4", "+5:30" },\r
- { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\u5370\u5ea6\u65f6\u95f4", "Asia/Calcutta" },\r
- { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u5370\u5EA6\u6807\u51c6\u65f6\u95f4", "Asia/Calcutta" },\r
-\r
- // ==========\r
-\r
- { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },\r
- { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" },\r
- { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" },\r
- { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" },\r
- { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" },\r
- { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" },\r
- { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" },\r
- { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u0938\u0902\u092f\u0941\u0915\u094d\u0924 \u0930\u093e\u091c\u094d\u092f \u0905\u092e\u0947\u0930\u093f\u0915\u093e (\u0932\u094b\u0938 \u090f\u0902\u091c\u093f\u0932\u0947\u0938)", "America/Los_Angeles" },\r
- { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u0938\u0902\u092f\u0941\u0915\u094d\u0924 \u0930\u093e\u091c\u094d\u092f \u0905\u092e\u0947\u0930\u093f\u0915\u093e (\u0932\u094b\u0938 \u090f\u0902\u091c\u093f\u0932\u0947\u0938)", "America/Los_Angeles" },\r
-\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },\r
- { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },\r
-\r
- { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },\r
- { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },\r
-\r
- { "hi", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },\r
- { "hi", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096b:\u0966\u0966", "-5:00" },\r
- { "hi", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u096b:\u0966\u0966", "-5:00" },\r
- { "hi", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u096b:\u0966\u0966", "-5:00" },\r
- { "hi", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },\r
- { "hi", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096a:\u0966\u0966", "-4:00" },\r
- { "hi", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u096a:\u0966\u0966", "-4:00" },\r
- { "hi", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u096a:\u0966\u0966", "-4:00" },\r
- { "hi", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u0915\u094d\u092f\u0942\u092c\u093e", "America/Havana" },\r
- { "hi", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u0915\u094d\u092f\u0942\u092c\u093e", "America/Havana" },\r
-\r
- { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },\r
- { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },\r
- { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },\r
- { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },\r
- { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },\r
- { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },\r
- { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },\r
- { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },\r
-\r
- { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },\r
- { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },\r
- { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },\r
- { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },\r
- { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },\r
- { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },\r
- { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },\r
- { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },\r
-\r
- { "hi", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },\r
- { "hi", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u0966:\u0966\u0966", "+0:00" },\r
- { "hi", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+\u0966\u0966:\u0966\u0966", "+0:00" },\r
- { "hi", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+\u0966\u0966:\u0966\u0966", "+0:00" },\r
- { "hi", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },\r
- { "hi", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u0967:\u0966\u0966", "+1:00" },\r
- { "hi", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+\u0966\u0967:\u0966\u0966", "+1:00" },\r
- { "hi", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+\u0966\u0967:\u0966\u0966", "+1:00" },\r
- { "hi", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u092C\u094D\u0930\u093F\u0924\u0928", "Europe/London" },\r
- { "hi", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u092C\u094D\u0930\u093F\u0924\u0928", "Europe/London" },\r
-\r
- { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
- { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },\r
-\r
- { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u096B:\u0969\u0966", "+5:30" },\r
- { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "IST", "+5:30" },\r
- { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\u092D\u093E\u0930\u0924\u0940\u092F \u0938\u092E\u092F", "+5:30" },\r
- { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u096B:\u0969\u0966", "+5:30" },\r
- { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "IST", "+05:30" },\r
- { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\u092D\u093E\u0930\u0924\u0940\u092F \u0938\u092E\u092F", "+5:30" },\r
- { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IST", "Asia/Calcutta" },\r
- { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u092D\u093E\u0930\u0924\u0940\u092F \u0938\u092E\u092F", "Asia/Calcutta" },\r
-\r
- // ==========\r
-\r
- { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },\r
- { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0800", "-8:00" },\r
- { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0800", "America/Los_Angeles" },\r
- { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },\r
- { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u0422\u0438\u0445\u043E\u043E\u043A\u0435\u0430\u043D\u0441\u043A\u0430 \u0447\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430", "America/Los_Angeles" },\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0700", "-7:00" },\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0700", "America/Los_Angeles" },\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u0422\u0438\u0445\u043E\u043E\u043A\u0435\u0430\u043D\u0441\u043A\u0430 \u043B\u044F\u0442\u043D\u0430 \u0447\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430", "America/Los_Angeles" },\r
- // icu bg.txt has exemplar city for this time zone\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u0421\u0410\u0429 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" },\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u0421\u0410\u0429 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" },\r
- { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\u0421\u0410\u0429 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" },\r
-\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },\r
- { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },\r
-\r
- { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },\r
- // icu bg.txt does not have info for this time zone\r
- { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },\r
- { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },\r
-\r
- { "bg", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },\r
- { "bg", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0500", "-5:00" },\r
- { "bg", "America/Havana", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0500", "-5:00" },\r
- { "bg", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0500", "-5:00" },\r
- { "bg", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },\r
- { "bg", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0400", "-4:00" },\r
- { "bg", "America/Havana", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0400", "-4:00" },\r
- { "bg", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0400", "-4:00" },\r
- { "bg", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u041a\u0443\u0431\u0430", "America/Havana" },\r
- { "bg", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u041a\u0443\u0431\u0430", "America/Havana" },\r
-\r
- { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+1100", "+11:00" },\r
- { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "z", GMT_BG+"+1100", "+11:00" },\r
- { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"+1100", "+11:00" },\r
- { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+1000", "+10:00" },\r
- { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "z", GMT_BG+"+1000", "+10:00" },\r
- { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+1000", "+10:00" },\r
- { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },\r
- { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },\r
-\r
- { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+1100", "+11:00" },\r
- { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", GMT_BG+"+1100", "+11:00" },\r
- { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"+1100", "+11:00" },\r
- { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+1000", "+10:00" },\r
- { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", GMT_BG+"+1000", "+10:00" },\r
- { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+1000", "+10:00" },\r
- { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },\r
- { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },\r
-\r
- { "bg", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },\r
- { "bg", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+0000", "+0:00" },\r
- { "bg", "Europe/London", "2004-01-15T00:00:00Z", "z", GMT_BG+"+0000", "+0:00" },\r
- { "bg", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\u0427\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430 \u0413\u0440\u0438\u043D\u0443\u0438\u0447", "+0:00" },\r
- { "bg", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },\r
- { "bg", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+0100", "+1:00" },\r
- { "bg", "Europe/London", "2004-07-15T00:00:00Z", "z", GMT_BG+"+0100", "+1:00" },\r
- { "bg", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+0100", "+1:00" },\r
- { "bg", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u041e\u0431\u0435\u0434\u0438\u043d\u0435\u043d\u043e \u043a\u0440\u0430\u043b\u0441\u0442\u0432\u043e", "Europe/London" },\r
- { "bg", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u041e\u0431\u0435\u0434\u0438\u043d\u0435\u043d\u043e \u043a\u0440\u0430\u043b\u0441\u0442\u0432\u043e", "Europe/London" },\r
-\r
- { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", GMT_BG+"-0300", "-3:00" },\r
- { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", GMT_BG+"-0300", "-3:00" },\r
-\r
- // JB#5150\r
- { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+0530", "+5:30" },\r
- { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", GMT_BG+"+0530", "+5:30" },\r
- { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"+0530", "+5:30" },\r
- { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+0530", "+5:30" },\r
- { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", GMT_BG+"+0530", "+05:30" },\r
- { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+0530", "+5:30" },\r
- { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\u0418\u043D\u0434\u0438\u044F", "Asia/Calcutta" },\r
- { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u0418\u043D\u0434\u0438\u044F", "Asia/Calcutta" },\r
-\r
- // ==========\r
-\r
- { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },\r
- { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },\r
- { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "America/Los_Angeles" },\r
- { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },\r
- { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6a19\u6e96\u6642", "America/Los_Angeles" },\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "America/Los_Angeles" },\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593", "America/Los_Angeles" },\r
- // icu ja.txt has exemplar city for this time zone\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD (\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9)", "America/Los_Angeles" },\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u30A2\u30E1\u30EA\u30AB\u592A\u5E73\u6D0B\u6642\u9593", "America/Los_Angeles" },\r
- { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD (\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9)", "America/Los_Angeles" },\r
-\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- // icu ja.txt does not have info for this time zone\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3 (\u30D6\u30A8\u30CE\u30B9\u30A2\u30A4\u30EC\u30B9)", "America/Buenos_Aires" },\r
- { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "America/Buenos_Aires" },\r
-\r
- { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- // icu ja.txt does not have info for this time zone\r
- { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3 (\u30D6\u30A8\u30CE\u30B9\u30A2\u30A4\u30EC\u30B9)", "America/Buenos_Aires" },\r
- { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "America/Buenos_Aires" },\r
-\r
- { "ja", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },\r
- { "ja", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },\r
- { "ja", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },\r
- { "ja", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },\r
- { "ja", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },\r
- { "ja", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },\r
- { "ja", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },\r
- { "ja", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },\r
- { "ja", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u30ad\u30e5\u30fc\u30d0\u6642\u9593", "America/Havana" },\r
- { "ja", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u30ad\u30e5\u30fc\u30d0\u6642\u9593", "America/Havana" },\r
-\r
- { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },\r
- { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },\r
- // icu ja.txt does not have info for this time zone\r
- { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },\r
- { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },\r
-\r
- { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },\r
- { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },\r
- { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },\r
- { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },\r
-\r
- { "ja", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },\r
- { "ja", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },\r
- { "ja", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },\r
- { "ja", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },\r
- { "ja", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\u30B0\u30EA\u30CB\u30C3\u30B8\u6A19\u6E96\u6642", "+0:00" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "V", "GMT+01:00", "+1:00" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u30a4\u30ae\u30ea\u30b9\u6642\u9593", "Europe/London" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u30a4\u30ae\u30ea\u30b9\u6642\u9593", "Europe/London" },\r
- { "ja", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\u30a4\u30ae\u30ea\u30b9\u6642\u9593", "Europe/London" },\r
-\r
- { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },\r
- { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },\r
-\r
- // JB#5150\r
- { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },\r
- { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },\r
- { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },\r
- { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },\r
- { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\u30A4\u30F3\u30C9\u6642\u9593", "Asia/Calcutta" },\r
- { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u30A4\u30F3\u30C9\u6642\u9593", "Asia/Calcutta" },\r
-\r
- // ==========\r
-\r
- { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },\r
- { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },\r
- { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },\r
- { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },\r
- { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },\r
- { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },\r
- { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },\r
- { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },\r
- { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "US (Los Angeles)", "America/Los_Angeles" },\r
- { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "US (Los Angeles)", "America/Los_Angeles" },\r
-\r
- { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },\r
- { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },\r
-\r
- { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },\r
- { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },\r
-\r
- { "si", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },\r
- { "si", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },\r
- { "si", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },\r
- { "si", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },\r
- { "si", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },\r
- { "si", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },\r
- { "si", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },\r
- { "si", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },\r
- { "si", "America/Havana", "2004-07-15T00:00:00Z", "v", "CU", "America/Havana" },\r
- { "si", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "CU", "America/Havana" },\r
-\r
- { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },\r
- { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },\r
- { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },\r
- { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },\r
-\r
- { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },\r
- { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },\r
- { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },\r
- { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },\r
- { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },\r
- { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },\r
- { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },\r
- { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },\r
- { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },\r
- { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },\r
-\r
- { "si", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },\r
- { "si", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },\r
- { "si", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },\r
- { "si", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },\r
- { "si", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },\r
- { "si", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },\r
- { "si", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },\r
- { "si", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },\r
- { "si", "Europe/London", "2004-07-15T00:00:00Z", "v", "GB", "Europe/London" },\r
- { "si", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "GB", "Europe/London" },\r
-\r
- { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },\r
- { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },\r
-\r
- // JB#5150\r
- { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },\r
- { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },\r
- { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },\r
- { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },\r
- { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },\r
- { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },\r
- { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IN", "Asia/Calcutta" },\r
- { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "IN", "Asia/Calcutta" },\r
- \r
- };\r
-\r
- /**\r
- * Verify that strings which contain incomplete specifications are parsed\r
- * correctly. In some instances, this means not being parsed at all, and\r
- * returning an appropriate error.\r
- */\r
- public void TestPartialParse994() {\r
- \r
- SimpleDateFormat f = new SimpleDateFormat();\r
- Calendar cal = Calendar.getInstance();\r
- cal.clear();\r
- cal.set(1997, 1 - 1, 17, 10, 11, 42);\r
- Date date = null;\r
- tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:11:42", cal.getTime());\r
- tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:", date);\r
- tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10", date);\r
- tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 ", date);\r
- tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17", date);\r
- }\r
- \r
- // internal test subroutine, used by TestPartialParse994\r
- public void tryPat994(SimpleDateFormat format, String pat, String str, Date expected) {\r
- Date Null = null;\r
- logln("Pattern \"" + pat + "\" String \"" + str + "\"");\r
- try {\r
- format.applyPattern(pat);\r
- Date date = format.parse(str); \r
- String f = ((DateFormat) format).format(date);\r
- logln(" parse(" + str + ") -> " + date);\r
- logln(" format -> " + f);\r
- if (expected.equals(Null) || !date.equals(expected))\r
- errln("FAIL: Expected null"); //" + expected);\r
- if (!f.equals(str))\r
- errln("FAIL: Expected " + str);\r
- } catch (ParseException e) {\r
- logln("ParseException: " + e.getMessage());\r
- if (!(expected ==Null))\r
- errln("FAIL: Expected " + expected);\r
- } catch (Exception e) {\r
- errln("*** Exception:");\r
- e.printStackTrace();\r
- }\r
- }\r
- \r
- /**\r
- * Verify the behavior of patterns in which digits for different fields run together\r
- * without intervening separators.\r
- */\r
- public void TestRunTogetherPattern985() {\r
- String format = "yyyyMMddHHmmssSSS";\r
- String now, then;\r
- //UBool flag;\r
- SimpleDateFormat formatter = new SimpleDateFormat(format);\r
- Date date1 = new Date();\r
- now = ((DateFormat) formatter).format(date1);\r
- logln(now);\r
- ParsePosition pos = new ParsePosition(0);\r
- Date date2 = formatter.parse(now, pos);\r
- if (date2 == null)\r
- then = "Parse stopped at " + pos.getIndex();\r
- else\r
- then = ((DateFormat) formatter).format(date2);\r
- logln(then);\r
- if (date2 == null || !date2.equals(date1))\r
- errln("FAIL");\r
- }\r
-\r
- /**\r
- * Verify the behavior of patterns in which digits for different fields run together\r
- * without intervening separators.\r
- */\r
- public void TestRunTogetherPattern917() {\r
- SimpleDateFormat fmt;\r
- String myDate;\r
- fmt = new SimpleDateFormat("yyyy/MM/dd");\r
- myDate = "1997/02/03";\r
- Calendar cal = Calendar.getInstance();\r
- cal.clear();\r
- cal.set(1997, 2 - 1, 3);\r
- _testIt917(fmt, myDate, cal.getTime());\r
- fmt = new SimpleDateFormat("yyyyMMdd");\r
- myDate = "19970304";\r
- cal.clear();\r
- cal.set(1997, 3 - 1, 4);\r
- _testIt917(fmt, myDate, cal.getTime());\r
- \r
- }\r
- \r
- // internal test subroutine, used by TestRunTogetherPattern917\r
- public void _testIt917(SimpleDateFormat fmt, String str, Date expected) {\r
- logln("pattern=" + fmt.toPattern() + " string=" + str);\r
- Date o = new Date();\r
- o = (Date) ((DateFormat) fmt).parseObject(str, new ParsePosition(0));\r
- logln("Parsed object: " + o);\r
- if (o == null || !o.equals(expected))\r
- errln("FAIL: Expected " + expected);\r
- String formatted = o==null? "null" : ((DateFormat) fmt).format(o);\r
- logln( "Formatted string: " + formatted);\r
- if (!formatted.equals(str))\r
- errln( "FAIL: Expected " + str);\r
- }\r
- \r
- /**\r
- * Verify the handling of Czech June and July, which have the unique attribute that\r
- * one is a proper prefix substring of the other.\r
- */\r
- public void TestCzechMonths459() {\r
- DateFormat fmt = DateFormat.getDateInstance(DateFormat.FULL, new Locale("cs", "", "")); \r
- logln("Pattern " + ((SimpleDateFormat) fmt).toPattern());\r
- Calendar cal = Calendar.getInstance();\r
- cal.clear();\r
- cal.set(1997, Calendar.JUNE, 15);\r
- Date june = cal.getTime();\r
- cal.clear();\r
- cal.set(1997, Calendar.JULY, 15);\r
- Date july = cal.getTime();\r
- String juneStr = fmt.format(june);\r
- String julyStr = fmt.format(july);\r
- try {\r
- logln("format(June 15 1997) = " + juneStr);\r
- Date d = fmt.parse(juneStr);\r
- String s = fmt.format(d);\r
- int month, yr, day;\r
- cal.setTime(d);\r
- yr = cal.get(Calendar.YEAR);\r
- month = cal.get(Calendar.MONTH);\r
- day = cal.get(Calendar.DAY_OF_MONTH);\r
- logln(" . parse . " + s + " (month = " + month + ")");\r
- if (month != Calendar.JUNE)\r
- errln("FAIL: Month should be June");\r
- if (yr != 1997)\r
- errln("FAIL: Year should be 1997");\r
- if (day != 15)\r
- errln("FAIL: day should be 15");\r
- logln("format(July 15 1997) = " + julyStr);\r
- d = fmt.parse(julyStr);\r
- s = fmt.format(d);\r
- cal.setTime(d);\r
- yr = cal.get(Calendar.YEAR) - 1900;\r
- month = cal.get(Calendar.MONTH);\r
- day = cal.get(Calendar.DAY_OF_WEEK);\r
- logln(" . parse . " + s + " (month = " + month + ")");\r
- if (month != Calendar.JULY)\r
- errln("FAIL: Month should be July");\r
- } catch (ParseException e) {\r
- errln(e.getMessage());\r
- }\r
- }\r
- \r
- /**\r
- * Test the handling of 'D' in patterns.\r
- */\r
- public void TestLetterDPattern212() {\r
- String dateString = "1995-040.05:01:29";\r
- String bigD = "yyyy-DDD.hh:mm:ss";\r
- String littleD = "yyyy-ddd.hh:mm:ss";\r
- Calendar cal = Calendar.getInstance();\r
- cal.clear();\r
- cal.set(1995, 0, 1, 5, 1, 29);\r
- Date expLittleD = cal.getTime();\r
- Date expBigD = new Date((long) (expLittleD.getTime() + 39 * 24 * 3600000.0));\r
- expLittleD = expBigD; // Expect the same, with default lenient parsing\r
- logln("dateString= " + dateString);\r
- SimpleDateFormat formatter = new SimpleDateFormat(bigD);\r
- ParsePosition pos = new ParsePosition(0);\r
- Date myDate = formatter.parse(dateString, pos);\r
- logln("Using " + bigD + " . " + myDate);\r
- if (!myDate.equals(expBigD))\r
- errln("FAIL: Expected " + expBigD);\r
- formatter = new SimpleDateFormat(littleD);\r
- pos = new ParsePosition(0);\r
- myDate = formatter.parse(dateString, pos);\r
- logln("Using " + littleD + " . " + myDate);\r
- if (!myDate.equals(expLittleD))\r
- errln("FAIL: Expected " + expLittleD);\r
- }\r
- \r
- /**\r
- * Test the day of year pattern.\r
- */\r
- public void TestDayOfYearPattern195() {\r
- Calendar cal = Calendar.getInstance();\r
- Date today = cal.getTime();\r
- int year,month,day; \r
- year = cal.get(Calendar.YEAR);\r
- month = cal.get(Calendar.MONTH);\r
- day = cal.get(Calendar.DAY_OF_MONTH);\r
- cal.clear();\r
- cal.set(year, month, day);\r
- Date expected = cal.getTime();\r
- logln("Test Date: " + today);\r
- SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getDateInstance();\r
- tryPattern(sdf, today, null, expected);\r
- tryPattern(sdf, today, "G yyyy DDD", expected);\r
- }\r
- \r
- // interl test subroutine, used by TestDayOfYearPattern195\r
- public void tryPattern(SimpleDateFormat sdf, Date d, String pattern, Date expected) {\r
- if (pattern != null)\r
- sdf.applyPattern(pattern);\r
- logln("pattern: " + sdf.toPattern());\r
- String formatResult = ((DateFormat) sdf).format(d);\r
- logln(" format -> " + formatResult);\r
- try {\r
- Date d2 = sdf.parse(formatResult);\r
- logln(" parse(" + formatResult + ") -> " + d2);\r
- if (!d2.equals(expected))\r
- errln("FAIL: Expected " + expected);\r
- String format2 = ((DateFormat) sdf).format(d2);\r
- logln(" format -> " + format2);\r
- if (!formatResult.equals(format2))\r
- errln("FAIL: Round trip drift");\r
- } catch (Exception e) {\r
- errln(e.getMessage());\r
- }\r
- }\r
- \r
- /**\r
- * Test the handling of single quotes in patterns.\r
- */\r
- public void TestQuotePattern161() {\r
- SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy 'at' hh:mm:ss a zzz", Locale.US); \r
- Calendar cal = Calendar.getInstance();\r
- cal.clear();\r
- cal.set(1997, Calendar.AUGUST, 13, 10, 42, 28);\r
- Date currentTime_1 = cal.getTime();\r
- String dateString = ((DateFormat) formatter).format(currentTime_1);\r
- String exp = "08/13/1997 at 10:42:28 AM ";\r
- logln("format(" + currentTime_1 + ") = " + dateString);\r
- if (!dateString.substring(0, exp.length()).equals(exp))\r
- errln("FAIL: Expected " + exp);\r
- \r
- }\r
- \r
- /**\r
- * Verify the correct behavior when handling invalid input strings.\r
- */\r
- public void TestBadInput135() {\r
- int looks[] = {DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, DateFormat.FULL}; \r
- int looks_length = looks.length;\r
- final String[] strings = {"Mar 15", "Mar 15 1997", "asdf", "3/1/97 1:23:", "3/1/00 1:23:45 AM"}; \r
- int strings_length = strings.length;\r
- DateFormat full = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.US); \r
- String expected = "March 1, 2000 1:23:45 AM ";\r
- for (int i = 0; i < strings_length; ++i) {\r
- final String text = strings[i];\r
- for (int j = 0; j < looks_length; ++j) {\r
- int dateLook = looks[j];\r
- for (int k = 0; k < looks_length; ++k) {\r
- int timeLook = looks[k];\r
- DateFormat df = DateFormat.getDateTimeInstance(dateLook, timeLook, Locale.US); \r
- String prefix = text + ", " + dateLook + "/" + timeLook + ": "; \r
- try {\r
- Date when = df.parse(text);\r
- if (when == null) {\r
- errln(prefix + "SHOULD NOT HAPPEN: parse returned null.");\r
- continue;\r
- } \r
- if (when != null) {\r
- String format;\r
- format = full.format(when);\r
- logln(prefix + "OK: " + format);\r
- if (!format.substring(0, expected.length()).equals(expected))\r
- errln("FAIL: Expected " + expected);\r
- }\r
- } catch(java.text.ParseException e) {\r
- logln(e.getMessage());\r
- }\r
- }\r
- }\r
- }\r
- }\r
- \r
- /**\r
- * Verify the correct behavior when parsing an array of inputs against an\r
- * array of patterns, with known results. The results are encoded after\r
- * the input strings in each row.\r
- */\r
- public void TestBadInput135a() {\r
- \r
- SimpleDateFormat dateParse = new SimpleDateFormat("", Locale.US);\r
- final String ss;\r
- Date date;\r
- String[] parseFormats ={"MMMM d, yyyy", "MMMM d yyyy", "M/d/yy",\r
- "d MMMM, yyyy", "d MMMM yyyy", "d MMMM",\r
- "MMMM d", "yyyy", "h:mm a MMMM d, yyyy" };\r
- String[] inputStrings = {\r
- "bogus string", null, null, null, null, null, null, null, null, null,\r
- "April 1, 1997", "April 1, 1997", null, null, null, null, null, "April 1", null, null,\r
- "Jan 1, 1970", "January 1, 1970", null, null, null, null, null, "January 1", null, null,\r
- "Jan 1 2037", null, "January 1 2037", null, null, null, null, "January 1", null, null,\r
- "1/1/70", null, null, "1/1/70", null, null, null, null, "0001", null,\r
- "5 May 1997", null, null, null, null, "5 May 1997", "5 May", null, "0005", null,\r
- "16 May", null, null, null, null, null, "16 May", null, "0016", null,\r
- "April 30", null, null, null, null, null, null, "April 30", null, null,\r
- "1998", null, null, null, null, null, null, null, "1998", null,\r
- "1", null, null, null, null, null, null, null, "0001", null,\r
- "3:00 pm Jan 1, 1997", null, null, null, null, null, null, null, "0003", "3:00 PM January 1, 1997",\r
- };\r
- final int PF_LENGTH = parseFormats.length;\r
- final int INPUT_LENGTH = inputStrings.length;\r
- \r
- dateParse.applyPattern("d MMMM, yyyy");\r
- dateParse.setTimeZone(TimeZone.getDefault());\r
- ss = "not parseable";\r
- // String thePat;\r
- logln("Trying to parse \"" + ss + "\" with " + dateParse.toPattern());\r
- try {\r
- date = dateParse.parse(ss);\r
- } catch (Exception ex) {\r
- logln("FAIL:" + ex);\r
- }\r
- for (int i = 0; i < INPUT_LENGTH; i += (PF_LENGTH + 1)) {\r
- ParsePosition parsePosition = new ParsePosition(0);\r
- String s = inputStrings[i];\r
- for (int index = 0; index < PF_LENGTH; ++index) {\r
- final String expected = inputStrings[i + 1 + index];\r
- dateParse.applyPattern(parseFormats[index]);\r
- dateParse.setTimeZone(TimeZone.getDefault());\r
- try {\r
- parsePosition.setIndex(0);\r
- date = dateParse.parse(s, parsePosition);\r
- if (parsePosition.getIndex() != 0) {\r
- String s1, s2;\r
- s1 = s.substring(0, parsePosition.getIndex());\r
- s2 = s.substring(parsePosition.getIndex(), s.length());\r
- if (date == null) {\r
- errln("ERROR: null result fmt=\"" + parseFormats[index]\r
- + "\" pos=" + parsePosition.getIndex()\r
- + " " + s1 + "|" + s2);\r
- } else {\r
- String result = ((DateFormat) dateParse).format(date);\r
- logln("Parsed \"" + s + "\" using \"" + dateParse.toPattern() + "\" to: " + result);\r
- if (expected == null)\r
- errln("FAIL: Expected parse failure");\r
- else\r
- if (!result.equals(expected))\r
- errln("FAIL: Expected " + expected);\r
- }\r
- } else\r
- if (expected != null) {\r
- errln("FAIL: Expected " + expected + " from \"" + s\r
- + "\" with \"" + dateParse.toPattern()+ "\"");\r
- }\r
- } catch (Exception ex) {\r
- logln("FAIL:" + ex);\r
- }\r
- }\r
- }\r
- \r
- }\r
- \r
- /**\r
- * Test the parsing of two-digit years.\r
- */\r
- public void TestTwoDigitYear() {\r
- DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);\r
- Calendar cal = Calendar.getInstance();\r
- cal.clear();\r
- cal.set(117 + 1900, Calendar.JUNE, 5);\r
- parse2DigitYear(fmt, "6/5/17", cal.getTime());\r
- cal.clear();\r
- cal.set(34 + 1900, Calendar.JUNE, 4);\r
- parse2DigitYear(fmt, "6/4/34", cal.getTime());\r
- }\r
- \r
- // internal test subroutine, used by TestTwoDigitYear\r
- public void parse2DigitYear(DateFormat fmt, String str, Date expected) {\r
- try {\r
- Date d = fmt.parse(str);\r
- logln("Parsing \""+ str+ "\" with "+ ((SimpleDateFormat) fmt).toPattern()\r
- + " => "+ d); \r
- if (!d.equals(expected))\r
- errln( "FAIL: Expected " + expected);\r
- } catch (ParseException e) {\r
- errln(e.getMessage());\r
- }\r
- }\r
- \r
- /**\r
- * Test the formatting of time zones.\r
- */\r
- public void TestDateFormatZone061() {\r
- Date date;\r
- DateFormat formatter;\r
- date = new Date(859248000000l);\r
- logln("Date 1997/3/25 00:00 GMT: " + date);\r
- formatter = new SimpleDateFormat("dd-MMM-yyyyy HH:mm", Locale.UK);\r
- formatter.setTimeZone(TimeZone.getTimeZone("GMT"));\r
- String temp = formatter.format(date);\r
- logln("Formatted in GMT to: " + temp);\r
- try {\r
- Date tempDate = formatter.parse(temp);\r
- logln("Parsed to: " + tempDate);\r
- if (!tempDate.equals(date))\r
- errln("FAIL: Expected " + date + " Got: " + tempDate);\r
- } catch (Throwable t) {\r
- System.out.println(t);\r
- }\r
- \r
- }\r
- \r
- /**\r
- * Test the formatting of time zones.\r
- */\r
- public void TestDateFormatZone146() {\r
- TimeZone saveDefault = TimeZone.getDefault();\r
- \r
- //try {\r
- TimeZone thedefault = TimeZone.getTimeZone("GMT");\r
- TimeZone.setDefault(thedefault);\r
- // java.util.Locale.setDefault(new java.util.Locale("ar", "", ""));\r
- \r
- // check to be sure... its GMT all right\r
- TimeZone testdefault = TimeZone.getDefault();\r
- String testtimezone = testdefault.getID();\r
- if (testtimezone.equals("GMT"))\r
- logln("Test timezone = " + testtimezone);\r
- else\r
- errln("Test timezone should be GMT, not " + testtimezone);\r
- \r
- // now try to use the default GMT time zone\r
- GregorianCalendar greenwichcalendar = new GregorianCalendar(1997, 3, 4, 23, 0);\r
- //*****************************greenwichcalendar.setTimeZone(TimeZone.getDefault());\r
- //greenwichcalendar.set(1997, 3, 4, 23, 0);\r
- // try anything to set hour to 23:00 !!!\r
- greenwichcalendar.set(Calendar.HOUR_OF_DAY, 23);\r
- // get time\r
- Date greenwichdate = greenwichcalendar.getTime();\r
- // format every way\r
- String DATA[] = {\r
- "simple format: ", "04/04/97 23:00 GMT+00:00", \r
- "MM/dd/yy HH:mm zzz", "full format: ", \r
- "Friday, April 4, 1997 11:00:00 o'clock PM GMT+00:00", \r
- "EEEE, MMMM d, yyyy h:mm:ss 'o''clock' a zzz", \r
- "long format: ", "April 4, 1997 11:00:00 PM GMT+00:00", \r
- "MMMM d, yyyy h:mm:ss a z", "default format: ", \r
- "04-Apr-97 11:00:00 PM", "dd-MMM-yy h:mm:ss a", \r
- "short format: ", "4/4/97 11:00 PM", \r
- "M/d/yy h:mm a"}; \r
- int DATA_length = DATA.length;\r
- \r
- for (int i = 0; i < DATA_length; i += 3) {\r
- DateFormat fmt = new SimpleDateFormat(DATA[i + 2], Locale.ENGLISH);\r
- fmt.setCalendar(greenwichcalendar);\r
- String result = fmt.format(greenwichdate);\r
- logln(DATA[i] + result);\r
- if (!result.equals(DATA[i + 1]))\r
- errln("FAIL: Expected " + DATA[i + 1] + ", got " + result);\r
- }\r
- //}\r
- //finally {\r
- TimeZone.setDefault(saveDefault);\r
- //}\r
- \r
- }\r
- \r
- /**\r
- * Test the formatting of dates in different locales.\r
- */\r
- public void TestLocaleDateFormat() {\r
- \r
- Date testDate = new Date(874306800000l); //Mon Sep 15 00:00:00 PDT 1997\r
- DateFormat dfFrench = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.FRENCH);\r
- DateFormat dfUS = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US);\r
- //Set TimeZone = PDT\r
- TimeZone tz = TimeZone.getTimeZone("PST");\r
- dfFrench.setTimeZone(tz);\r
- dfUS.setTimeZone(tz);\r
- String expectedFRENCH_JDK12 = "lundi 15 septembre 1997 00:00:00 heure avanc\u00E9e du Pacifique";\r
- //String expectedFRENCH = "lundi 15 septembre 1997 00 h 00 PDT";\r
- String expectedUS = "Monday, September 15, 1997 12:00:00 AM Pacific Daylight Time";\r
- logln("Date set to : " + testDate);\r
- String out = dfFrench.format(testDate);\r
- logln("Date Formated with French Locale " + out);\r
- //fix the jdk resources differences between jdk 1.2 and jdk 1.3\r
- /* our own data only has GMT-xxxx information here\r
- String javaVersion = System.getProperty("java.version");\r
- if (javaVersion.startsWith("1.2")) {\r
- if (!out.equals(expectedFRENCH_JDK12))\r
- errln("FAIL: Expected " + expectedFRENCH_JDK12+" Got "+out);\r
- } else {\r
- if (!out.equals(expectedFRENCH))\r
- errln("FAIL: Expected " + expectedFRENCH);\r
- }\r
- */\r
- if (!out.equals(expectedFRENCH_JDK12))\r
- errln("FAIL: Expected " + expectedFRENCH_JDK12+" Got "+out);\r
- out = dfUS.format(testDate);\r
- logln("Date Formated with US Locale " + out);\r
- if (!out.equals(expectedUS))\r
- errln("FAIL: Expected " + expectedUS+" Got "+out);\r
- }\r
-\r
- /**\r
- * Test the formatting of dates with the 'NONE' keyword.\r
- */\r
- public void TestDateFormatNone() {\r
- \r
- Date testDate = new Date(874306800000l); //Mon Sep 15 00:00:00 PDT 1997\r
- DateFormat dfFrench = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.NONE, Locale.FRENCH);\r
- //Set TimeZone = PDT\r
- TimeZone tz = TimeZone.getTimeZone("PST");\r
- dfFrench.setTimeZone(tz);\r
- String expectedFRENCH_JDK12 = "lundi 15 septembre 1997";\r
- //String expectedFRENCH = "lundi 15 septembre 1997 00 h 00 PDT";\r
- logln("Date set to : " + testDate);\r
- String out = dfFrench.format(testDate);\r
- logln("Date Formated with French Locale " + out);\r
- if (!out.equals(expectedFRENCH_JDK12))\r
- errln("FAIL: Expected " + expectedFRENCH_JDK12+" Got "+out);\r
- }\r
-\r
-\r
- /**\r
- * Test DateFormat(Calendar) API\r
- */\r
- public void TestDateFormatCalendar() {\r
- DateFormat date=null, time=null, full=null;\r
- Calendar cal=null;\r
- ParsePosition pos = new ParsePosition(0);\r
- String str;\r
- Date when;\r
-\r
- /* Create a formatter for date fields. */\r
- date = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);\r
- if (date == null) {\r
- errln("FAIL: getDateInstance failed");\r
- return;\r
- }\r
-\r
- /* Create a formatter for time fields. */\r
- time = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.US);\r
- if (time == null) {\r
- errln("FAIL: getTimeInstance failed");\r
- return;\r
- }\r
-\r
- /* Create a full format for output */\r
- full = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL,\r
- Locale.US);\r
- if (full == null) {\r
- errln("FAIL: getInstance failed");\r
- return;\r
- }\r
-\r
- /* Create a calendar */\r
- cal = Calendar.getInstance(Locale.US);\r
- if (cal == null) {\r
- errln("FAIL: Calendar.getInstance failed");\r
- return;\r
- }\r
-\r
- /* Parse the date */\r
- cal.clear();\r
- str = "4/5/2001";\r
- pos.setIndex(0);\r
- date.parse(str, cal, pos);\r
- if (pos.getIndex() != str.length()) {\r
- errln("FAIL: DateFormat.parse(4/5/2001) failed at " +\r
- pos.getIndex());\r
- return;\r
- }\r
-\r
- /* Parse the time */\r
- str = "5:45 PM";\r
- pos.setIndex(0);\r
- time.parse(str, cal, pos);\r
- if (pos.getIndex() != str.length()) {\r
- errln("FAIL: DateFormat.parse(17:45) failed at " +\r
- pos.getIndex());\r
- return;\r
- }\r
- \r
- /* Check result */\r
- when = cal.getTime();\r
- str = full.format(when);\r
- // Thursday, April 5, 2001 5:45:00 PM PDT 986517900000\r
- if (when.getTime() == 986517900000.0) {\r
- logln("Ok: Parsed result: " + str);\r
- } else {\r
- errln("FAIL: Parsed result: " + str + ", exp 4/5/2001 5:45 PM");\r
- }\r
- }\r
-\r
- /**\r
- * Test DateFormat's parsing of space characters. See jitterbug 1916.\r
- */\r
- public void TestSpaceParsing() {\r
-\r
- String DATA[] = {\r
- "yyyy MM dd",\r
-\r
- // pattern, input, expected output (in quotes)\r
- "MMMM d yy", " 04 05 06", null, // MMMM wants Apr/April\r
- null, "04 05 06", null,\r
- "MM d yy", " 04 05 06", "2006 04 05",\r
- null, "04 05 06", "2006 04 05",\r
- "MMMM d yy", " Apr 05 06", "2006 04 05",\r
- null, "Apr 05 06", "2006 04 05",\r
- };\r
-\r
- expectParse(DATA, new Locale("en", "", ""));\r
- }\r
-\r
- /**\r
- * Test handling of "HHmmss" pattern.\r
- */\r
- public void TestExactCountFormat() {\r
- String DATA[] = {\r
- "yyyy MM dd HH:mm:ss",\r
-\r
- // pattern, input, expected parse or null if expect parse failure\r
- "HHmmss", "123456", "1970 01 01 12:34:56",\r
- null, "12345", "1970 01 01 01:23:45",\r
- null, "1234", null,\r
- null, "00-05", null,\r
- null, "12-34", null,\r
- null, "00+05", null,\r
- "ahhmm", "PM730", "1970 01 01 19:30:00",\r
- };\r
-\r
- expectParse(DATA, new Locale("en", "", ""));\r
- }\r
-\r
- /**\r
- * Test handling of white space.\r
- */\r
- public void TestWhiteSpaceParsing() {\r
- String DATA[] = {\r
- "yyyy MM dd",\r
-\r
- // pattern, input, expected parse or null if expect parse failure\r
-\r
- // Pattern space run should parse input text space run\r
- "MM d yy", " 04 01 03", "2003 04 01",\r
- null, " 04 01 03 ", "2003 04 01",\r
- };\r
-\r
- expectParse(DATA, new Locale("en", "", ""));\r
- }\r
-\r
- public void TestInvalidPattern() {\r
- Exception e = null;\r
- SimpleDateFormat f = null;\r
- String out = null;\r
- try {\r
- f = new SimpleDateFormat("Yesterday");\r
- out = f.format(new Date(0));\r
- } catch (IllegalArgumentException e1) {\r
- e = e1;\r
- }\r
- if (e != null) {\r
- logln("Ok: Received " + e.getMessage());\r
- } else {\r
- errln("FAIL: Expected exception, got " + f.toPattern() +\r
- "; " + out);\r
- }\r
- }\r
-\r
- public void TestGreekMay() {\r
- Date date = new Date(-9896080848000L);\r
- SimpleDateFormat fmt = new SimpleDateFormat("EEEE, dd MMMM yyyy h:mm:ss a",\r
- new Locale("el", "", ""));\r
- String str = fmt.format(date);\r
- ParsePosition pos = new ParsePosition(0);\r
- Date d2 = fmt.parse(str, pos);\r
- if (!date.equals(d2)) {\r
- errln("FAIL: unable to parse strings where case-folding changes length");\r
- }\r
- }\r
-\r
- public void testErrorChecking() {\r
- try {\r
- DateFormat.getDateTimeInstance(-1, -1, Locale.US);\r
- errln("Expected exception for getDateTimeInstance(-1, -1, Locale)");\r
- }\r
- catch(IllegalArgumentException e) {\r
- logln("one ok");\r
- }\r
- catch(Exception e) {\r
- warnln("Expected IllegalArgumentException, got: " + e);\r
- }\r
- \r
- try {\r
- DateFormat df = new SimpleDateFormat("aabbccc");\r
- df.format(new Date());\r
- errln("Expected exception for format with bad pattern");\r
- }\r
- catch(IllegalArgumentException ex) {\r
- logln("two ok");\r
- }\r
- catch(Exception e) {\r
- warnln("Expected IllegalArgumentException, got: " + e);\r
- }\r
- \r
- {\r
- SimpleDateFormat fmt = new SimpleDateFormat("dd/MM/yy"); // opposite of text\r
- fmt.set2DigitYearStart(getDate(2003, Calendar.DECEMBER, 25));\r
- String text = "12/25/03";\r
- Calendar xcal = new GregorianCalendar();\r
- xcal.setLenient(false);\r
- ParsePosition pp = new ParsePosition(0);\r
- fmt.parse(text, xcal, pp); // should get parse error on second field, not lenient\r
- if (pp.getErrorIndex() == -1) {\r
- errln("Expected parse error");\r
- } else {\r
- logln("three ok");\r
- }\r
- }\r
- }\r
-\r
- public void TestChineseDateFormatLocalizedPatternChars() {\r
- // jb 4904\r
- // make sure we can display localized versions of the chars used in the default\r
- // chinese date format patterns\r
- Calendar chineseCalendar = new ChineseCalendar();\r
- chineseCalendar.setTimeInMillis((new Date()).getTime());\r
- SimpleDateFormat longChineseDateFormat = \r
- (SimpleDateFormat)chineseCalendar.getDateTimeFormat(DateFormat.LONG, DateFormat.LONG, Locale.CHINA );\r
- DateFormatSymbols dfs = new ChineseDateFormatSymbols( chineseCalendar, Locale.CHINA );\r
- longChineseDateFormat.setDateFormatSymbols( dfs );\r
- // This next line throws the exception\r
- try {\r
- longChineseDateFormat.toLocalizedPattern();\r
- }\r
- catch (Exception e) {\r
- errln("could not localized pattern: " + e.getMessage());\r
- }\r
- }\r
-\r
- public void TestCoverage() {\r
- Date now = new Date();\r
- Calendar cal = new GregorianCalendar();\r
- DateFormat f = DateFormat.getTimeInstance();\r
- logln("time: " + f.format(now));\r
-\r
- int hash = f.hashCode(); // sigh, everyone overrides this\r
- \r
- f = DateFormat.getInstance(cal);\r
- if(hash == f.hashCode()){\r
- errln("FAIL: hashCode equal for inequal objects");\r
- }\r
- logln("time again: " + f.format(now));\r
-\r
- f = DateFormat.getTimeInstance(cal, DateFormat.FULL);\r
- logln("time yet again: " + f.format(now));\r
-\r
- f = DateFormat.getDateInstance();\r
- logln("time yet again: " + f.format(now));\r
-\r
- ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME,"de_DE");\r
- DateFormatSymbols sym = new DateFormatSymbols(rb, Locale.GERMANY);\r
- DateFormatSymbols sym2 = (DateFormatSymbols)sym.clone();\r
- if (sym.hashCode() != sym2.hashCode()) {\r
- errln("fail, date format symbols hashcode not equal");\r
- }\r
- if (!sym.equals(sym2)) {\r
- errln("fail, date format symbols not equal");\r
- }\r
- \r
- Locale foo = new Locale("fu", "FU", "BAR");\r
- rb = null;\r
- sym = new DateFormatSymbols(GregorianCalendar.class, foo);\r
- sym.equals(null);\r
- \r
- sym = new ChineseDateFormatSymbols();\r
- sym = new ChineseDateFormatSymbols(new ChineseCalendar(), foo);\r
- // cover new ChineseDateFormatSymbols(Calendar, ULocale)\r
- ChineseCalendar ccal = new ChineseCalendar();\r
- sym = new ChineseDateFormatSymbols(ccal, ULocale.CHINA); //gclsh1 add\r
- \r
- StringBuffer buf = new StringBuffer();\r
- FieldPosition pos = new FieldPosition(0);\r
- \r
- f.format((Object)cal, buf, pos);\r
- f.format((Object)now, buf, pos);\r
- f.format((Object)new Long(now.getTime()), buf, pos);\r
- try {\r
- f.format((Object)"Howdy", buf, pos);\r
- }\r
- catch (Exception e) {\r
- }\r
-\r
- NumberFormat nf = f.getNumberFormat();\r
- f.setNumberFormat(nf);\r
- \r
- boolean lenient = f.isLenient();\r
- f.setLenient(lenient);\r
- \r
- ULocale uloc = f.getLocale(ULocale.ACTUAL_LOCALE);\r
- \r
- DateFormat sdfmt = new SimpleDateFormat();\r
- \r
- if (f.hashCode() != f.hashCode()) {\r
- errln("hashCode is not stable");\r
- }\r
- if (!f.equals(f)) {\r
- errln("f != f");\r
- }\r
- if (f.equals(null)) {\r
- errln("f should not equal null");\r
- }\r
- if (f.equals(sdfmt)) {\r
- errln("A time instance shouldn't equal a default date format");\r
- }\r
- \r
- Date d;\r
- {\r
- ChineseDateFormat fmt = new ChineseDateFormat("yymm", Locale.US);\r
- try {\r
- fmt.parse("2"); // fewer symbols than required 2\r
- errln("whoops");\r
- }\r
- catch (ParseException e) {\r
- logln("ok");\r
- }\r
-\r
- try {\r
- fmt.parse("2255"); // should succeed with obeycount\r
- logln("ok");\r
- }\r
- catch (ParseException e) {\r
- errln("whoops");\r
- }\r
-\r
- try {\r
- fmt.parse("ni hao"); // not a number, should fail\r
- errln("whoops ni hao");\r
- }\r
- catch (ParseException e) {\r
- logln("ok ni hao");\r
- }\r
- }\r
- {\r
- Calendar xcal = new GregorianCalendar();\r
- xcal.set(Calendar.HOUR_OF_DAY, 0);\r
- DateFormat fmt = new SimpleDateFormat("k");\r
- StringBuffer xbuf = new StringBuffer();\r
- FieldPosition fpos = new FieldPosition(Calendar.HOUR_OF_DAY);\r
- fmt.format(xcal, xbuf, fpos);\r
- try {\r
- fmt.parse(xbuf.toString());\r
- logln("ok");\r
- \r
- xbuf.setLength(0);\r
- xcal.set(Calendar.HOUR_OF_DAY, 25);\r
- fmt.format(xcal, xbuf, fpos);\r
- Date d2 = fmt.parse(xbuf.toString());\r
- logln("ok again - d2=" + d2);\r
- }\r
- catch (ParseException e) {\r
- errln("whoops");\r
- }\r
- }\r
- \r
- {\r
- // cover gmt+hh:mm\r
- DateFormat fmt = new SimpleDateFormat("MM/dd/yy z");\r
- try {\r
- d = fmt.parse("07/10/53 GMT+10:00");\r
- logln("ok : d = " + d);\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 GMT+10:00 for pattern MM/dd/yy z");\r
- }\r
- \r
- // cover invalid separator after GMT\r
- {\r
- ParsePosition pp = new ParsePosition(0);\r
- String text = "07/10/53 GMT=10:00";\r
- d = fmt.parse(text, pp);\r
- if(pp.getIndex()!=12){\r
- errln("Parse of 07/10/53 GMT=10:00 for pattern MM/dd/yy z");\r
- }\r
- logln("Parsing of the text stopped at pos: " + pp.getIndex() + " as expected and length is "+text.length());\r
- }\r
- \r
- // cover bad text after GMT+.\r
- try {\r
- fmt.parse("07/10/53 GMT+blecch");\r
- logln("ok GMT+blecch");\r
- }\r
- catch (ParseException e) {\r
- errln("whoops GMT+blecch");\r
- }\r
- \r
- // cover bad text after GMT+hh:.\r
- try {\r
- fmt.parse("07/10/53 GMT+07:blecch");\r
- logln("ok GMT+xx:blecch");\r
- }\r
- catch (ParseException e) {\r
- errln("whoops GMT+xx:blecch");\r
- }\r
- \r
- // cover no ':' GMT+#, # < 24 (hh)\r
- try {\r
- d = fmt.parse("07/10/53 GMT+07");\r
- logln("ok GMT+07");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 GMT+07 for pattern MM/dd/yy z");\r
- }\r
- \r
- // cover no ':' GMT+#, # > 24 (hhmm)\r
- try {\r
- d = fmt.parse("07/10/53 GMT+0730");\r
- logln("ok");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 GMT+0730 for pattern MM/dd/yy z");\r
- }\r
- \r
- // cover GMT+#, # with second field\r
- try {\r
- d = fmt.parse("07/10/53 GMT+07:30:15");\r
- logln("ok GMT+07:30:15");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 GMT+07:30:15 for pattern MM/dd/yy z");\r
- }\r
-\r
- // cover no ':' GMT+#, # with second field, no leading zero\r
- try {\r
- d = fmt.parse("07/10/53 GMT+73015");\r
- logln("ok GMT+73015");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 GMT+73015 for pattern MM/dd/yy z");\r
- }\r
-\r
- // cover no ':' GMT+#, # with 1 digit second field\r
- try {\r
- d = fmt.parse("07/10/53 GMT+07300");\r
- logln("ok GMT+07300");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 GMT+07300 for pattern MM/dd/yy z");\r
- }\r
- \r
- // cover raw digits with no leading sign (bad RFC822) \r
- try {\r
- d = fmt.parse("07/10/53 07");\r
- errln("Parse of 07/10/53 07 for pattern MM/dd/yy z passed!");\r
- }\r
- catch (ParseException e) {\r
- logln("ok");\r
- }\r
- \r
- // cover raw digits (RFC822) \r
- try {\r
- d = fmt.parse("07/10/53 +07");\r
- logln("ok");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 +07 for pattern MM/dd/yy z failed");\r
- }\r
- \r
- // cover raw digits (RFC822) \r
- try {\r
- d = fmt.parse("07/10/53 -0730");\r
- logln("ok");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 -00730 for pattern MM/dd/yy z failed");\r
- }\r
- \r
- // cover raw digits (RFC822) in DST\r
- try {\r
- fmt.setTimeZone(TimeZone.getTimeZone("PDT"));\r
- d = fmt.parse("07/10/53 -0730");\r
- logln("ok");\r
- }\r
- catch (ParseException e) {\r
- errln("Parse of 07/10/53 -0730 for pattern MM/dd/yy z failed");\r
- }\r
- }\r
- \r
- // TODO: revisit toLocalizedPattern\r
- if (false) {\r
- SimpleDateFormat fmt = new SimpleDateFormat("aabbcc");\r
- try {\r
- String pat = fmt.toLocalizedPattern();\r
- errln("whoops, shouldn't have been able to localize aabbcc");\r
- }\r
- catch (IllegalArgumentException e) {\r
- logln("aabbcc localize ok");\r
- }\r
- }\r
-\r
- {\r
- SimpleDateFormat fmt = new SimpleDateFormat("'aabbcc");\r
- try {\r
- fmt.toLocalizedPattern();\r
- errln("whoops, localize unclosed quote");\r
- }\r
- catch (IllegalArgumentException e) {\r
- logln("localize unclosed quote ok");\r
- }\r
- }\r
- {\r
- SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy z");\r
- String text = "08/15/58 DBDY"; // bogus time zone\r
- try {\r
- fmt.parse(text);\r
- errln("recognized bogus time zone DBDY");\r
- }\r
- catch (ParseException e) {\r
- logln("time zone ex ok");\r
- }\r
- }\r
- \r
- {\r
- // force fallback to default timezone when fmt timezone \r
- // is not named\r
- SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy z");\r
- // force fallback to default time zone, still fails\r
- fmt.setTimeZone(TimeZone.getTimeZone("GMT+0147")); // not in equivalency group\r
- String text = "08/15/58 DBDY";\r
- try {\r
- fmt.parse(text);\r
- errln("Parse of 07/10/53 DBDY for pattern MM/dd/yy z passed");\r
- }\r
- catch (ParseException e) {\r
- logln("time zone ex2 ok");\r
- }\r
- \r
- // force success on fallback\r
- text = "08/15/58 " + TimeZone.getDefault().getID();\r
- try {\r
- fmt.parse(text);\r
- logln("found default tz");\r
- }\r
- catch (ParseException e) {\r
- errln("whoops, got parse exception");\r
- }\r
- }\r
- \r
- {\r
- // force fallback to symbols list of timezones when neither \r
- // fmt and default timezone is named\r
- SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy z");\r
- TimeZone oldtz = TimeZone.getDefault();\r
- TimeZone newtz = TimeZone.getTimeZone("GMT+0137"); // nonstandard tz\r
- fmt.setTimeZone(newtz);\r
- TimeZone.setDefault(newtz); // todo: fix security issue\r
-\r
- // fallback to symbol list, but fail\r
- String text = "08/15/58 DBDY"; // try to parse the bogus time zone\r
- try {\r
- fmt.parse(text);\r
- errln("Parse of 07/10/53 DBDY for pattern MM/dd/yy z passed");\r
- }\r
- catch (ParseException e) {\r
- logln("time zone ex3 ok");\r
- }\r
- catch (Exception e) {\r
- // hmmm... this shouldn't happen. don't want to exit this\r
- // fn with timezone improperly set, so just in case\r
- TimeZone.setDefault(oldtz);\r
- throw new IllegalStateException(e.getMessage());\r
- }\r
-\r
- // create DFS that recognizes our bogus time zone, sortof\r
- DateFormatSymbols xsym = new DateFormatSymbols();\r
- String[][] tzids = xsym.getZoneStrings();\r
- if (tzids.length > 0) { // let's hope!\r
- tzids[0][1] = "DBDY"; // change a local name\r
- logln("replaced '" + tzids[0][0] + "' with DBDY");\r
-\r
- xsym.setZoneStrings(tzids);\r
- fmt.setDateFormatSymbols(xsym);\r
-\r
- try {\r
- fmt.parse(text);\r
- logln("we parsed DBDY (as GMT, but still...)");\r
- }\r
- catch (ParseException e) {\r
- errln("hey, still didn't recognize DBDY");\r
- }\r
- finally {\r
- TimeZone.setDefault(oldtz);\r
- }\r
- }\r
- }\r
-\r
- {\r
- //cover getAvailableULocales\r
- final ULocale[] locales = DateFormat.getAvailableULocales();\r
- long count = locales.length;\r
- if (count==0) {\r
- errln(" got a empty list for getAvailableULocales");\r
- }else{\r
- logln("" + count + " available ulocales"); \r
- }\r
- }\r
- \r
- {\r
- //cover DateFormatSymbols.getDateFormatBundle\r
- cal = new GregorianCalendar();\r
- Locale loc = Locale.getDefault();\r
- DateFormatSymbols mysym = new DateFormatSymbols(cal, loc);\r
- if (mysym == null) \r
- errln("FAIL: constructs DateFormatSymbols with calendar and locale failed");\r
- \r
- uloc = ULocale.getDefault();\r
- // These APIs are obsolete and return null\r
- ResourceBundle resb = DateFormatSymbols.getDateFormatBundle(cal, loc);\r
- ResourceBundle resb2 = DateFormatSymbols.getDateFormatBundle(cal, uloc);\r
- ResourceBundle resb3 = DateFormatSymbols.getDateFormatBundle(cal.getClass(), loc);\r
- ResourceBundle resb4 = DateFormatSymbols.getDateFormatBundle(cal.getClass(), uloc);\r
-\r
- if (resb != null) {\r
- logln("resb is not null");\r
- }\r
- if (resb2 != null) {\r
- logln("resb2 is not null");\r
- }\r
- if (resb3 != null) {\r
- logln("resb3 is not null");\r
- }\r
- if (resb4 != null) {\r
- logln("resb4 is not null");\r
- }\r
- }\r
-\r
- {\r
- //cover DateFormatSymbols.getInstance\r
- DateFormatSymbols datsym1 = DateFormatSymbols.getInstance();\r
- DateFormatSymbols datsym2 = new DateFormatSymbols();\r
- if (!datsym1.equals(datsym2)) {\r
- errln("FAIL: DateFormatSymbols returned by getInstance()" +\r
- "does not match new DateFormatSymbols().");\r
- }\r
- datsym1 = DateFormatSymbols.getInstance(Locale.JAPAN);\r
- datsym2 = DateFormatSymbols.getInstance(ULocale.JAPAN);\r
- if (!datsym1.equals(datsym2)) {\r
- errln("FAIL: DateFormatSymbols returned by getInstance(Locale.JAPAN)" +\r
- "does not match the one returned by getInstance(ULocale.JAPAN).");\r
- }\r
- }\r
- {\r
- //cover DateFormatSymbols.getAvailableLocales/getAvailableULocales\r
- Locale[] allLocales = DateFormatSymbols.getAvailableLocales();\r
- if (allLocales.length == 0) {\r
- errln("FAIL: Got a empty list for DateFormatSymbols.getAvailableLocales");\r
- } else {\r
- logln("PASS: " + allLocales.length +\r
- " available locales returned by DateFormatSymbols.getAvailableLocales"); \r
- }\r
-\r
- ULocale[] allULocales = DateFormatSymbols.getAvailableULocales();\r
- if (allULocales.length == 0) {\r
- errln("FAIL: Got a empty list for DateFormatSymbols.getAvailableLocales");\r
- } else {\r
- logln("PASS: " + allULocales.length +\r
- " available locales returned by DateFormatSymbols.getAvailableULocales"); \r
- }\r
- }\r
- }\r
-\r
- public void TestStandAloneMonths()\r
- {\r
- String EN_DATA[] = {\r
- "yyyy MM dd HH:mm:ss",\r
-\r
- "yyyy LLLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 March 10 16:36:31", "2004 03 10 16:36:31",\r
- "yyyy LLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31",\r
- "yyyy LLLL dd H:mm:ss", "F", "2004 03 10 16:36:31", "2004 March 10 16:36:31",\r
- "yyyy LLL dd H:mm:ss", "pf", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31",\r
- \r
- "LLLL", "fp", "1970 01 01 0:00:00", "January", "1970 01 01 0:00:00",\r
- "LLLL", "fp", "1970 02 01 0:00:00", "February", "1970 02 01 0:00:00",\r
- "LLLL", "fp", "1970 03 01 0:00:00", "March", "1970 03 01 0:00:00",\r
- "LLLL", "fp", "1970 04 01 0:00:00", "April", "1970 04 01 0:00:00",\r
- "LLLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",\r
- "LLLL", "fp", "1970 06 01 0:00:00", "June", "1970 06 01 0:00:00",\r
- "LLLL", "fp", "1970 07 01 0:00:00", "July", "1970 07 01 0:00:00",\r
- "LLLL", "fp", "1970 08 01 0:00:00", "August", "1970 08 01 0:00:00",\r
- "LLLL", "fp", "1970 09 01 0:00:00", "September", "1970 09 01 0:00:00",\r
- "LLLL", "fp", "1970 10 01 0:00:00", "October", "1970 10 01 0:00:00",\r
- "LLLL", "fp", "1970 11 01 0:00:00", "November", "1970 11 01 0:00:00",\r
- "LLLL", "fp", "1970 12 01 0:00:00", "December", "1970 12 01 0:00:00",\r
- \r
- "LLL", "fp", "1970 01 01 0:00:00", "Jan", "1970 01 01 0:00:00",\r
- "LLL", "fp", "1970 02 01 0:00:00", "Feb", "1970 02 01 0:00:00",\r
- "LLL", "fp", "1970 03 01 0:00:00", "Mar", "1970 03 01 0:00:00",\r
- "LLL", "fp", "1970 04 01 0:00:00", "Apr", "1970 04 01 0:00:00",\r
- "LLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",\r
- "LLL", "fp", "1970 06 01 0:00:00", "Jun", "1970 06 01 0:00:00",\r
- "LLL", "fp", "1970 07 01 0:00:00", "Jul", "1970 07 01 0:00:00",\r
- "LLL", "fp", "1970 08 01 0:00:00", "Aug", "1970 08 01 0:00:00",\r
- "LLL", "fp", "1970 09 01 0:00:00", "Sep", "1970 09 01 0:00:00",\r
- "LLL", "fp", "1970 10 01 0:00:00", "Oct", "1970 10 01 0:00:00",\r
- "LLL", "fp", "1970 11 01 0:00:00", "Nov", "1970 11 01 0:00:00",\r
- "LLL", "fp", "1970 12 01 0:00:00", "Dec", "1970 12 01 0:00:00",\r
- };\r
- \r
- String CS_DATA[] = {\r
- "yyyy MM dd HH:mm:ss",\r
-\r
- "yyyy LLLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 duben 10 16:36:31", "2004 04 10 16:36:31",\r
- "yyyy MMMM dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31",\r
- "yyyy LLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 4. 10 16:36:31", "2004 04 10 16:36:31",\r
- "yyyy LLLL dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 duben 10 16:36:31",\r
- "yyyy MMMM dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31",\r
- "yyyy LLLL dd H:mm:ss", "pf", "2004 duben 10 16:36:31", "2004 04 10 16:36:31", "2004 duben 10 16:36:31",\r
- "yyyy MMMM dd H:mm:ss", "pf", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31",\r
- \r
- "LLLL", "fp", "1970 01 01 0:00:00", "leden", "1970 01 01 0:00:00",\r
- "LLLL", "fp", "1970 02 01 0:00:00", "\u00FAnor", "1970 02 01 0:00:00",\r
- "LLLL", "fp", "1970 03 01 0:00:00", "b\u0159ezen", "1970 03 01 0:00:00",\r
- "LLLL", "fp", "1970 04 01 0:00:00", "duben", "1970 04 01 0:00:00",\r
- "LLLL", "fp", "1970 05 01 0:00:00", "kv\u011Bten", "1970 05 01 0:00:00",\r
- "LLLL", "fp", "1970 06 01 0:00:00", "\u010Derven", "1970 06 01 0:00:00",\r
- "LLLL", "fp", "1970 07 01 0:00:00", "\u010Dervenec", "1970 07 01 0:00:00",\r
- "LLLL", "fp", "1970 08 01 0:00:00", "srpen", "1970 08 01 0:00:00",\r
- "LLLL", "fp", "1970 09 01 0:00:00", "z\u00E1\u0159\u00ED", "1970 09 01 0:00:00",\r
- "LLLL", "fp", "1970 10 01 0:00:00", "\u0159\u00EDjen", "1970 10 01 0:00:00",\r
- "LLLL", "fp", "1970 11 01 0:00:00", "listopad", "1970 11 01 0:00:00",\r
- "LLLL", "fp", "1970 12 01 0:00:00", "prosinec", "1970 12 01 0:00:00",\r
-\r
- "LLL", "fp", "1970 01 01 0:00:00", "1.", "1970 01 01 0:00:00",\r
- "LLL", "fp", "1970 02 01 0:00:00", "2.", "1970 02 01 0:00:00",\r
- "LLL", "fp", "1970 03 01 0:00:00", "3.", "1970 03 01 0:00:00",\r
- "LLL", "fp", "1970 04 01 0:00:00", "4.", "1970 04 01 0:00:00",\r
- "LLL", "fp", "1970 05 01 0:00:00", "5.", "1970 05 01 0:00:00",\r
- "LLL", "fp", "1970 06 01 0:00:00", "6.", "1970 06 01 0:00:00",\r
- "LLL", "fp", "1970 07 01 0:00:00", "7.", "1970 07 01 0:00:00",\r
- "LLL", "fp", "1970 08 01 0:00:00", "8.", "1970 08 01 0:00:00",\r
- "LLL", "fp", "1970 09 01 0:00:00", "9.", "1970 09 01 0:00:00",\r
- "LLL", "fp", "1970 10 01 0:00:00", "10.", "1970 10 01 0:00:00",\r
- "LLL", "fp", "1970 11 01 0:00:00", "11.", "1970 11 01 0:00:00",\r
- "LLL", "fp", "1970 12 01 0:00:00", "12.", "1970 12 01 0:00:00",\r
- };\r
- \r
- expect(EN_DATA, new Locale("en", "", ""));\r
- expect(CS_DATA, new Locale("cs", "", ""));\r
- }\r
- \r
- public void TestStandAloneDays()\r
- {\r
- String EN_DATA[] = {\r
- "yyyy MM dd HH:mm:ss",\r
-\r
- "cccc", "fp", "1970 01 04 0:00:00", "Sunday", "1970 01 04 0:00:00",\r
- "cccc", "fp", "1970 01 05 0:00:00", "Monday", "1970 01 05 0:00:00",\r
- "cccc", "fp", "1970 01 06 0:00:00", "Tuesday", "1970 01 06 0:00:00",\r
- "cccc", "fp", "1970 01 07 0:00:00", "Wednesday", "1970 01 07 0:00:00",\r
- "cccc", "fp", "1970 01 01 0:00:00", "Thursday", "1970 01 01 0:00:00",\r
- "cccc", "fp", "1970 01 02 0:00:00", "Friday", "1970 01 02 0:00:00",\r
- "cccc", "fp", "1970 01 03 0:00:00", "Saturday", "1970 01 03 0:00:00",\r
- \r
- "ccc", "fp", "1970 01 04 0:00:00", "Sun", "1970 01 04 0:00:00",\r
- "ccc", "fp", "1970 01 05 0:00:00", "Mon", "1970 01 05 0:00:00",\r
- "ccc", "fp", "1970 01 06 0:00:00", "Tue", "1970 01 06 0:00:00",\r
- "ccc", "fp", "1970 01 07 0:00:00", "Wed", "1970 01 07 0:00:00",\r
- "ccc", "fp", "1970 01 01 0:00:00", "Thu", "1970 01 01 0:00:00",\r
- "ccc", "fp", "1970 01 02 0:00:00", "Fri", "1970 01 02 0:00:00",\r
- "ccc", "fp", "1970 01 03 0:00:00", "Sat", "1970 01 03 0:00:00",\r
- };\r
- \r
- String CS_DATA[] = {\r
- "yyyy MM dd HH:mm:ss",\r
-\r
- "cccc", "fp", "1970 01 04 0:00:00", "ned\u011Ble", "1970 01 04 0:00:00",\r
- "cccc", "fp", "1970 01 05 0:00:00", "pond\u011Bl\u00ED", "1970 01 05 0:00:00",\r
- "cccc", "fp", "1970 01 06 0:00:00", "\u00FAter\u00FD", "1970 01 06 0:00:00",\r
- "cccc", "fp", "1970 01 07 0:00:00", "st\u0159eda", "1970 01 07 0:00:00",\r
- "cccc", "fp", "1970 01 01 0:00:00", "\u010Dtvrtek", "1970 01 01 0:00:00",\r
- "cccc", "fp", "1970 01 02 0:00:00", "p\u00E1tek", "1970 01 02 0:00:00",\r
- "cccc", "fp", "1970 01 03 0:00:00", "sobota", "1970 01 03 0:00:00",\r
- \r
- "ccc", "fp", "1970 01 04 0:00:00", "ne", "1970 01 04 0:00:00",\r
- "ccc", "fp", "1970 01 05 0:00:00", "po", "1970 01 05 0:00:00",\r
- "ccc", "fp", "1970 01 06 0:00:00", "\u00FAt", "1970 01 06 0:00:00",\r
- "ccc", "fp", "1970 01 07 0:00:00", "st", "1970 01 07 0:00:00",\r
- "ccc", "fp", "1970 01 01 0:00:00", "\u010Dt", "1970 01 01 0:00:00",\r
- "ccc", "fp", "1970 01 02 0:00:00", "p\u00E1", "1970 01 02 0:00:00",\r
- "ccc", "fp", "1970 01 03 0:00:00", "so", "1970 01 03 0:00:00",\r
- };\r
- \r
- expect(EN_DATA, new Locale("en", "", ""));\r
- expect(CS_DATA, new Locale("cs", "", ""));\r
- }\r
- \r
- public void TestNarrowNames()\r
- {\r
- String EN_DATA[] = {\r
- "yyyy MM dd HH:mm:ss",\r
-\r
- "yyyy MMMMM dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",\r
- "yyyy LLLLL dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",\r
- \r
- "MMMMM", "1970 01 01 0:00:00", "J",\r
- "MMMMM", "1970 02 01 0:00:00", "F",\r
- "MMMMM", "1970 03 01 0:00:00", "M",\r
- "MMMMM", "1970 04 01 0:00:00", "A",\r
- "MMMMM", "1970 05 01 0:00:00", "M",\r
- "MMMMM", "1970 06 01 0:00:00", "J",\r
- "MMMMM", "1970 07 01 0:00:00", "J",\r
- "MMMMM", "1970 08 01 0:00:00", "A",\r
- "MMMMM", "1970 09 01 0:00:00", "S",\r
- "MMMMM", "1970 10 01 0:00:00", "O",\r
- "MMMMM", "1970 11 01 0:00:00", "N",\r
- "MMMMM", "1970 12 01 0:00:00", "D",\r
- \r
- "LLLLL", "1970 01 01 0:00:00", "J",\r
- "LLLLL", "1970 02 01 0:00:00", "F",\r
- "LLLLL", "1970 03 01 0:00:00", "M",\r
- "LLLLL", "1970 04 01 0:00:00", "A",\r
- "LLLLL", "1970 05 01 0:00:00", "M",\r
- "LLLLL", "1970 06 01 0:00:00", "J",\r
- "LLLLL", "1970 07 01 0:00:00", "J",\r
- "LLLLL", "1970 08 01 0:00:00", "A",\r
- "LLLLL", "1970 09 01 0:00:00", "S",\r
- "LLLLL", "1970 10 01 0:00:00", "O",\r
- "LLLLL", "1970 11 01 0:00:00", "N",\r
- "LLLLL", "1970 12 01 0:00:00", "D",\r
-\r
- "EEEEE", "1970 01 04 0:00:00", "S",\r
- "EEEEE", "1970 01 05 0:00:00", "M",\r
- "EEEEE", "1970 01 06 0:00:00", "T",\r
- "EEEEE", "1970 01 07 0:00:00", "W",\r
- "EEEEE", "1970 01 01 0:00:00", "T",\r
- "EEEEE", "1970 01 02 0:00:00", "F",\r
- "EEEEE", "1970 01 03 0:00:00", "S",\r
- \r
- "ccccc", "1970 01 04 0:00:00", "S",\r
- "ccccc", "1970 01 05 0:00:00", "M",\r
- "ccccc", "1970 01 06 0:00:00", "T",\r
- "ccccc", "1970 01 07 0:00:00", "W",\r
- "ccccc", "1970 01 01 0:00:00", "T",\r
- "ccccc", "1970 01 02 0:00:00", "F",\r
- "ccccc", "1970 01 03 0:00:00", "S",\r
- };\r
- \r
- String CS_DATA[] = {\r
- "yyyy MM dd HH:mm:ss",\r
-\r
- "yyyy LLLLL dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",\r
- "yyyy MMMMM dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",\r
- \r
- "MMMMM", "1970 01 01 0:00:00", "l",\r
- "MMMMM", "1970 02 01 0:00:00", "\u00FA",\r
- "MMMMM", "1970 03 01 0:00:00", "b",\r
- "MMMMM", "1970 04 01 0:00:00", "d",\r
- "MMMMM", "1970 05 01 0:00:00", "k",\r
- "MMMMM", "1970 06 01 0:00:00", "\u010D",\r
- "MMMMM", "1970 07 01 0:00:00", "\u010D",\r
- "MMMMM", "1970 08 01 0:00:00", "s",\r
- "MMMMM", "1970 09 01 0:00:00", "z",\r
- "MMMMM", "1970 10 01 0:00:00", "\u0159",\r
- "MMMMM", "1970 11 01 0:00:00", "l",\r
- "MMMMM", "1970 12 01 0:00:00", "p",\r
- \r
- "LLLLL", "1970 01 01 0:00:00", "l",\r
- "LLLLL", "1970 02 01 0:00:00", "\u00FA",\r
- "LLLLL", "1970 03 01 0:00:00", "b",\r
- "LLLLL", "1970 04 01 0:00:00", "d",\r
- "LLLLL", "1970 05 01 0:00:00", "k",\r
- "LLLLL", "1970 06 01 0:00:00", "\u010D",\r
- "LLLLL", "1970 07 01 0:00:00", "\u010D",\r
- "LLLLL", "1970 08 01 0:00:00", "s",\r
- "LLLLL", "1970 09 01 0:00:00", "z",\r
- "LLLLL", "1970 10 01 0:00:00", "\u0159",\r
- "LLLLL", "1970 11 01 0:00:00", "l",\r
- "LLLLL", "1970 12 01 0:00:00", "p",\r
-\r
- "EEEEE", "1970 01 04 0:00:00", "N",\r
- "EEEEE", "1970 01 05 0:00:00", "P",\r
- "EEEEE", "1970 01 06 0:00:00", "\u00DA",\r
- "EEEEE", "1970 01 07 0:00:00", "S",\r
- "EEEEE", "1970 01 01 0:00:00", "\u010C",\r
- "EEEEE", "1970 01 02 0:00:00", "P",\r
- "EEEEE", "1970 01 03 0:00:00", "S",\r
-\r
- "ccccc", "1970 01 04 0:00:00", "N",\r
- "ccccc", "1970 01 05 0:00:00", "P",\r
- "ccccc", "1970 01 06 0:00:00", "\u00DA",\r
- "ccccc", "1970 01 07 0:00:00", "S",\r
- "ccccc", "1970 01 01 0:00:00", "\u010C",\r
- "ccccc", "1970 01 02 0:00:00", "P",\r
- "ccccc", "1970 01 03 0:00:00", "S",\r
- };\r
- \r
- expectFormat(EN_DATA, new Locale("en", "", ""));\r
- expectFormat(CS_DATA, new Locale("cs", "", ""));\r
- }\r
- \r
- public void TestEras()\r
- {\r
- String EN_DATA[] = {\r
- "yyyy MM dd",\r
-\r
- "MMMM dd yyyy G", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",\r
- "MMMM dd yyyy GG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",\r
- "MMMM dd yyyy GGG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",\r
- "MMMM dd yyyy GGGG", "fp", "1951 07 17", "July 17 1951 Anno Domini", "1951 07 17",\r
-\r
- "MMMM dd yyyy G", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",\r
- "MMMM dd yyyy GG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",\r
- "MMMM dd yyyy GGG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",\r
- "MMMM dd yyyy GGGG", "fp", "-438 07 17", "July 17 0439 Before Christ", "-438 07 17",\r
- };\r
- \r
- expect(EN_DATA, new Locale("en", "", ""));\r
- }\r
-/* \r
- public void TestQuarters()\r
- {\r
- String EN_DATA[] = {\r
- "yyyy MM dd",\r
-\r
- "Q", "fp", "1970 01 01", "1", "1970 01 01",\r
- "QQ", "fp", "1970 04 01", "02", "1970 04 01",\r
- "QQQ", "fp", "1970 07 01", "Q3", "1970 07 01",\r
- "QQQQ", "fp", "1970 10 01", "4th quarter", "1970 10 01",\r
-\r
- "q", "fp", "1970 01 01", "1", "1970 01 01",\r
- "qq", "fp", "1970 04 01", "02", "1970 04 01",\r
- "qqq", "fp", "1970 07 01", "Q3", "1970 07 01",\r
- "qqqq", "fp", "1970 10 01", "4th quarter", "1970 10 01",\r
- };\r
- \r
- expect(EN_DATA, new Locale("en", "", ""));\r
- }\r
-*/\r
-\r
- /**\r
- * Test DateFormat's parsing of default GMT variants. See ticket#6135\r
- */\r
- public void TestGMTParsing() {\r
- String DATA[] = {\r
- "HH:mm:ss Z",\r
-\r
- // pattern, input, expected output (in quotes)\r
- "HH:mm:ss Z", "10:20:30 GMT+03:00", "10:20:30 +0300",\r
- "HH:mm:ss Z", "10:20:30 UT-02:00", "10:20:30 -0200",\r
- "HH:mm:ss Z", "10:20:30 GMT", "10:20:30 +0000",\r
- "HH:mm:ss vvvv", "10:20:30 UT+10:00", "10:20:30 +1000",\r
- "HH:mm:ss zzzz", "10:20:30 UTC", "10:20:30 +0000", // standalone "UTC"\r
- "ZZZZ HH:mm:ss", "UT 10:20:30", "10:20:30 +0000",\r
- "V HH:mm:ss", "UT+0130 10:20:30", "10:20:30 +0130",\r
- "V HH:mm:ss", "UTC+0130 10:20:30", null, // UTC+0130 is not a supported pattern\r
- "HH mm Z ss", "10 20 GMT-1100 30", "10:20:30 -1100",\r
- };\r
- expectParse(DATA, new Locale("en", "", ""));\r
- }\r
-\r
- /**\r
- * Test parsing. Input is an array that starts with the following\r
- * header:\r
- *\r
- * [0] = pattern string to parse [i+2] with\r
- *\r
- * followed by test cases, each of which is 3 array elements:\r
- *\r
- * [i] = pattern, or null to reuse prior pattern\r
- * [i+1] = input string\r
- * [i+2] = expected parse result (parsed with pattern [0])\r
- *\r
- * If expect parse failure, then [i+2] should be null.\r
- */\r
- void expectParse(String[] data, Locale loc) {\r
- Date FAIL = null;\r
- String FAIL_STR = "parse failure";\r
- int i = 0;\r
-\r
- SimpleDateFormat fmt = new SimpleDateFormat("", loc);\r
- SimpleDateFormat ref = new SimpleDateFormat(data[i++], loc);\r
- SimpleDateFormat gotfmt = new SimpleDateFormat("G yyyy MM dd HH:mm:ss z", loc);\r
-\r
- String currentPat = null;\r
- while (i<data.length) {\r
- String pattern = data[i++];\r
- String input = data[i++];\r
- String expected = data[i++];\r
-\r
- if (pattern != null) {\r
- fmt.applyPattern(pattern);\r
- currentPat = pattern;\r
- }\r
- String gotstr = FAIL_STR;\r
- Date got;\r
- try {\r
- got = fmt.parse(input);\r
- gotstr = gotfmt.format(got);\r
- } catch (ParseException e1) {\r
- got = FAIL;\r
- }\r
-\r
- Date exp = FAIL;\r
- String expstr = FAIL_STR;\r
- if (expected != null) {\r
- expstr = expected;\r
- try {\r
- exp = ref.parse(expstr);\r
- } catch (ParseException e2) {\r
- errln("FAIL: Internal test error");\r
- }\r
- }\r
-\r
- if (got == exp || (got != null && got.equals(exp))) {\r
- logln("Ok: " + input + " x " +\r
- currentPat + " => " + gotstr); \r
- } else {\r
- errln("FAIL: " + input + " x " +\r
- currentPat + " => " + gotstr + ", expected " +\r
- expstr);\r
- }\r
- } \r
- }\r
- \r
- /**\r
- * Test formatting. Input is an array of String that starts\r
- * with a single 'header' element\r
- *\r
- * [0] = reference dateformat pattern string (ref)\r
- *\r
- * followed by test cases, each of which is 4 or 5 elements:\r
- *\r
- * [i] = test dateformat pattern string (test), or null to reuse prior test pattern\r
- * [i+1] = data string A\r
- * [i+2] = data string B\r
- *\r
- * Formats a date, checks the result.\r
- *\r
- * Examples:\r
- * "y/M/d H:mm:ss.SSS", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567"\r
- * -- ref.parse A, get t0\r
- * -- test.format t0, get r0\r
- * -- compare r0 to B, fail if not equal\r
- */\r
- void expectFormat(String[] data, Locale loc)\r
- {\r
- int i = 1;\r
- String currentPat = null;\r
- SimpleDateFormat ref = new SimpleDateFormat(data[0], loc);\r
-\r
- while (i<data.length) {\r
- SimpleDateFormat fmt = new SimpleDateFormat("", loc);\r
- String pattern = data[i++];\r
- if (pattern != null) {\r
- fmt.applyPattern(pattern);\r
- currentPat = pattern;\r
- }\r
-\r
- String datestr = data[i++];\r
- String string = data[i++];\r
- Date date = null;\r
- \r
- try {\r
- date = ref.parse(datestr);\r
- } catch (ParseException e) {\r
- errln("FAIL: Internal test error; can't parse " + datestr);\r
- continue;\r
- }\r
- \r
- assertEquals("\"" + currentPat + "\".format(" + datestr + ")",\r
- string,\r
- fmt.format(date));\r
- }\r
- }\r
-\r
- /**\r
- * Test formatting and parsing. Input is an array of String that starts\r
- * with a single 'header' element\r
- *\r
- * [0] = reference dateformat pattern string (ref)\r
- *\r
- * followed by test cases, each of which is 4 or 5 elements:\r
- *\r
- * [i] = test dateformat pattern string (test), or null to reuse prior test pattern\r
- * [i+1] = control string, either "fp", "pf", or "F".\r
- * [i+2] = data string A\r
- * [i+3] = data string B\r
- * [i+4] = data string C (not present for 'F' control string)\r
- *\r
- * Note: the number of data strings depends on the control string.\r
- *\r
- * fp formats a date, checks the result, then parses the result and checks against a (possibly different) date\r
- * pf parses a string, checks the result, then formats the result and checks against a (possibly different) string\r
- * F is a shorthand for fp when the second date is the same as the first\r
- * P is a shorthand for pf when the second string is the same as the first\r
- *\r
- * Examples:\r
- * (fp) "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.56", "2004 03 10 16:36:31.560",\r
- * -- ref.parse A, get t0\r
- * -- test.format t0, get r0\r
- * -- compare r0 to B, fail if not equal\r
- * -- test.parse B, get t1\r
- * -- ref.parse C, get t2\r
- * -- compare t1 and t2, fail if not equal\r
- *\r
- * (F) "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567"\r
- * -- ref.parse A, get t0\r
- * -- test.format t0, get r0\r
- * -- compare r0 to B, fail if not equal\r
- * -- test.parse B, get t1\r
- * -- compare t1 and t0, fail if not equal\r
- *\r
- * (pf) "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5670",\r
- * -- test.parse A, get t0\r
- * -- ref.parse B, get t1\r
- * -- compare t0 to t1, fail if not equal\r
- * -- test.format t1, get r0\r
- * -- compare r0 and C, fail if not equal\r
- *\r
- * (P) "y/M/d H:mm:ss.SSSS", "P", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567"",\r
- * -- test.parse A, get t0\r
- * -- ref.parse B, get t1\r
- * -- compare t0 to t1, fail if not equal\r
- * -- test.format t1, get r0\r
- * -- compare r0 and A, fail if not equal\r
- */\r
- void expect(String[] data, Locale loc) {\r
- int i = 1;\r
- SimpleDateFormat univ = new SimpleDateFormat("EE G yyyy MM dd HH:mm:ss.SSS zzz", loc);\r
- String currentPat = null;\r
- SimpleDateFormat ref = new SimpleDateFormat(data[0], loc);\r
-\r
- while (i<data.length) {\r
- SimpleDateFormat fmt = new SimpleDateFormat("", loc);\r
- String pattern = data[i++];\r
- if (pattern != null) {\r
- fmt.applyPattern(pattern);\r
- currentPat = pattern;\r
- }\r
-\r
- String control = data[i++];\r
-\r
- if (control.equals("fp") || control.equals("F")) {\r
- // 'f'\r
- String datestr = data[i++];\r
- String string = data[i++];\r
- String datestr2 = datestr;\r
- if (control.length() == 2) {\r
- datestr2 = data[i++];\r
- }\r
- Date date = null;\r
- try {\r
- date = ref.parse(datestr);\r
- } catch (ParseException e) {\r
- errln("FAIL: Internal test error; can't parse " + datestr);\r
- continue;\r
- }\r
- assertEquals("\"" + currentPat + "\".format(" + datestr + ")",\r
- string,\r
- fmt.format(date));\r
- // 'p'\r
- if (!datestr2.equals(datestr)) {\r
- try {\r
- date = ref.parse(datestr2);\r
- } catch (ParseException e2) {\r
- errln("FAIL: Internal test error; can't parse " + datestr2);\r
- continue;\r
- }\r
- }\r
- try {\r
- Date parsedate = fmt.parse(string);\r
- assertEquals("\"" + currentPat + "\".parse(" + string + ")",\r
- univ.format(date),\r
- univ.format(parsedate));\r
- } catch (ParseException e3) {\r
- errln("FAIL: \"" + currentPat + "\".parse(" + string + ") => " +\r
- e3);\r
- continue;\r
- }\r
- }\r
- else if (control.equals("pf") || control.equals("P")) {\r
- // 'p'\r
- String string = data[i++];\r
- String datestr = data[i++];\r
- String string2 = string;\r
- if (control.length() == 2) {\r
- string2 = data[i++];\r
- }\r
-\r
- Date date = null;\r
- try {\r
- date = ref.parse(datestr);\r
- } catch (ParseException e) {\r
- errln("FAIL: Internal test error; can't parse " + datestr);\r
- continue;\r
- }\r
- try {\r
- Date parsedate = fmt.parse(string);\r
- assertEquals("\"" + currentPat + "\".parse(" + string + ")",\r
- univ.format(date),\r
- univ.format(parsedate));\r
- } catch (ParseException e2) {\r
- errln("FAIL: \"" + currentPat + "\".parse(" + string + ") => " +\r
- e2);\r
- continue;\r
- }\r
- // 'f'\r
- assertEquals("\"" + currentPat + "\".format(" + datestr + ")",\r
- string2,\r
- fmt.format(date));\r
- }\r
- else {\r
- errln("FAIL: Invalid control string " + control);\r
- return;\r
- }\r
- }\r
- }\r
- /*\r
- public void TestJB4757(){\r
- DateFormat dfmt = DateFormat.getDateInstance(DateFormat.FULL, ULocale.ROOT);\r
- }\r
- */\r
-\r
-//#if defined(FOUNDATION10) || defined(J2SE13)\r
-//#else\r
- /*\r
- * Test case for formatToCharacterIterator\r
- */\r
- public void TestFormatToCharacterIterator() {\r
- // Generate pattern string including all pattern letters with various length\r
- AttributedCharacterIterator acit;\r
- final char SEPCHAR = '~';\r
- String[] patterns = new String[5];\r
- StringBuffer sb = new StringBuffer();\r
- for (int i = 0; i < patterns.length; i++) {\r
- sb.setLength(0);\r
- for (int j = 0; j < PATTERN_CHARS.length(); j++) {\r
- if (j != 0) {\r
- for (int k = 0; k <= i; k++) {\r
- sb.append(SEPCHAR);\r
- }\r
- }\r
- char letter = PATTERN_CHARS.charAt(j);\r
- for (int k = 0; k <= i; k++) {\r
- sb.append(letter);\r
- }\r
- }\r
- patterns[i] = sb.toString();\r
- }\r
- if (isVerbose()) {\r
- for (int i = 0; i < patterns.length; i++) {\r
- logln("patterns[" + i + "] = " + patterns[i]);\r
- }\r
- }\r
-\r
- Calendar cal = Calendar.getInstance();\r
- cal.set(2007, Calendar.JULY, 16, 8, 20, 25);\r
- cal.set(Calendar.MILLISECOND, 567);\r
- final Date d = cal.getTime();\r
-\r
- // Test AttributedCharacterIterator returned by SimpleDateFormat\r
- for (int i = 0; i < patterns.length; i++) {\r
- SimpleDateFormat sdf = new SimpleDateFormat(patterns[i]);\r
- acit = sdf.formatToCharacterIterator(d);\r
- int patidx = 0;\r
-\r
- while (true) {\r
- Map map = acit.getAttributes();\r
- int limit = acit.getRunLimit();\r
- if (map.isEmpty()) {\r
- // Must be pattern literal - '~'\r
- while (acit.getIndex() < limit) {\r
- if (acit.current() != SEPCHAR) {\r
- errln("FAIL: Invalid pattern literal at " + acit.current() + " in patterns[" + i + "]");\r
- }\r
- acit.next();\r
- }\r
- } else {\r
- Set keySet = map.keySet();\r
- if (keySet.size() == 1) {\r
- // Check the attribute\r
- Iterator keyIterator = keySet.iterator();\r
- DateFormat.Field attr = (DateFormat.Field)keyIterator.next();\r
- if (!DATEFORMAT_FIELDS[patidx].equals(attr)) {\r
- errln("FAIL: The attribute at " + acit.getIndex() + " in patterns[" + i + "" +\r
- "] is " + attr + " - Expected: " + DATEFORMAT_FIELDS[patidx]);\r
- }\r
- } else {\r
- // SimpleDateFormat#formatToCharacterIterator never set multiple\r
- // attributes to a single text run.\r
- errln("FAIL: Multiple attributes were set");\r
- }\r
- patidx++;\r
- // Move to the run limit\r
- acit.setIndex(limit);\r
- }\r
- if (acit.current() == CharacterIterator.DONE) {\r
- break;\r
- }\r
- }\r
- }\r
-\r
- // ChineseDateFormat has pattern letter 'l' for leap month marker in addition to regular DateFormat\r
- cal.clear();\r
- cal.set(2009, Calendar.JUNE, 22); // 26x78-5-30\r
- Date nonLeapMonthDate = cal.getTime(); // non-leap month\r
- cal.set(2009, Calendar.JUNE, 23); // 26x78-5*-1\r
- Date leapMonthDate = cal.getTime(); // leap month\r
-\r
- ChineseDateFormat cdf = new ChineseDateFormat("y'x'G-Ml-d", ULocale.US);\r
- acit = cdf.formatToCharacterIterator(nonLeapMonthDate);\r
- Set keys = acit.getAllAttributeKeys();\r
- if (keys.contains(ChineseDateFormat.Field.IS_LEAP_MONTH)) {\r
- errln("FAIL: IS_LEAP_MONTH attribute must not present for Chinese calendar date "\r
- + cdf.format(nonLeapMonthDate));\r
- }\r
- acit = cdf.formatToCharacterIterator(leapMonthDate);\r
- keys = acit.getAllAttributeKeys();\r
- if (!keys.contains(ChineseDateFormat.Field.IS_LEAP_MONTH)) {\r
- errln("FAIL: IS_LEAP_MONTH attribute must present for Chinese calendar date "\r
- + cdf.format(leapMonthDate));\r
- }\r
- }\r
-\r
- /*\r
- * API coverage test case for formatToCharacterIterator\r
- */\r
- public void TestFormatToCharacterIteratorCoverage() {\r
- // Calling formatToCharacterIterator, using various argument types\r
- DateFormat df = DateFormat.getDateTimeInstance();\r
- AttributedCharacterIterator acit = null;\r
-\r
- Calendar cal = Calendar.getInstance();\r
- try {\r
- acit = df.formatToCharacterIterator(cal);\r
- if (acit == null) {\r
- errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(Calendar)");\r
- }\r
- } catch (IllegalArgumentException iae) {\r
- errln("FAIL: Calendar must be accepted by formatToCharacterIterator");\r
- }\r
-\r
- Date d = cal.getTime();\r
- try {\r
- acit = df.formatToCharacterIterator(d);\r
- if (acit == null) {\r
- errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(Date)");\r
- }\r
- } catch (IllegalArgumentException iae) {\r
- errln("FAIL: Date must be accepted by formatToCharacterIterator");\r
- }\r
-\r
- Number num = new Long(d.getTime());\r
- try {\r
- acit = df.formatToCharacterIterator(num);\r
- if (acit == null) {\r
- errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(Number)");\r
- }\r
- } catch (IllegalArgumentException iae) {\r
- errln("FAIL: Number must be accepted by formatToCharacterIterator");\r
- }\r
-\r
- boolean isException = false;\r
- String str = df.format(d);\r
- try {\r
- acit = df.formatToCharacterIterator(str);\r
- if (acit == null) {\r
- errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(String)");\r
- }\r
- } catch (IllegalArgumentException iae) {\r
- logln("IllegalArgumentException is thrown by formatToCharacterIterator");\r
- isException = true;\r
- }\r
- if (!isException) {\r
- errln("FAIL: String must not be accepted by formatToCharacterIterator");\r
- }\r
-\r
- // DateFormat.Field#ofCalendarField and getCalendarField\r
- for (int i = 0; i < DATEFORMAT_FIELDS.length; i++) {\r
- int calField = DATEFORMAT_FIELDS[i].getCalendarField();\r
- if (calField != -1) {\r
- DateFormat.Field field = DateFormat.Field.ofCalendarField(calField);\r
- if (field != DATEFORMAT_FIELDS[i]) {\r
- errln("FAIL: " + field + " is returned for a Calendar field " + calField\r
- + " - Expected: " + DATEFORMAT_FIELDS[i]);\r
- }\r
- }\r
- }\r
-\r
- // IllegalArgument for ofCalendarField\r
- isException = false;\r
- try {\r
- DateFormat.Field.ofCalendarField(-1);\r
- } catch (IllegalArgumentException iae) {\r
- logln("IllegalArgumentException is thrown by ofCalendarField");\r
- isException = true;\r
- }\r
- if (!isException) {\r
- errln("FAIL: IllegalArgumentException must be thrown by ofCalendarField for calendar field value -1");\r
- }\r
-\r
- // ChineseDateFormat.Field#ofCalendarField and getCalendarField\r
- int ccalField = ChineseDateFormat.Field.IS_LEAP_MONTH.getCalendarField();\r
- if (ccalField != ChineseCalendar.IS_LEAP_MONTH) {\r
- errln("FAIL: ChineseCalendar field " + ccalField + " is returned for ChineseDateFormat.Field.IS_LEAP_MONTH.getCalendarField()");\r
- } else {\r
- DateFormat.Field cfield = ChineseDateFormat.Field.ofCalendarField(ccalField);\r
- if (cfield != ChineseDateFormat.Field.IS_LEAP_MONTH) {\r
- errln("FAIL: " + cfield + " is returned for a ChineseCalendar field " + ccalField\r
- + " - Expected: " + ChineseDateFormat.Field.IS_LEAP_MONTH);\r
- }\r
- }\r
- }\r
-//#endif\r
-\r
- /*\r
- * Test for checking SimpleDateFormat/DateFormatSymbols creation\r
- * honor the calendar keyword in the given locale. See ticket#6100\r
- */\r
- public void TestCalendarType() {\r
- final String testPattern = "GGGG y MMMM d EEEE";\r
-\r
- final ULocale[] testLocales = {\r
- new ULocale("de"),\r
- new ULocale("fr_FR@calendar=gregorian"),\r
- new ULocale("en@calendar=islamic"),\r
- new ULocale("ja_JP@calendar=japanese"),\r
- new ULocale("zh_Hans_CN@calendar=bogus"),\r
- };\r
-\r
- SimpleDateFormat[] formatters = new SimpleDateFormat[5];\r
- for (int i = 0; i < testLocales.length; i++) {\r
- // Create a locale with no keywords\r
- StringBuffer locStrBuf = new StringBuffer();\r
- if (testLocales[i].getLanguage().length() > 0) {\r
- locStrBuf.append(testLocales[i].getLanguage());\r
- }\r
- if (testLocales[i].getScript().length() > 0) {\r
- locStrBuf.append('_');\r
- locStrBuf.append(testLocales[i].getScript());\r
- }\r
- if (testLocales[i].getCountry().length() > 0) {\r
- locStrBuf.append('_');\r
- locStrBuf.append(testLocales[i].getCountry());\r
- }\r
- ULocale locNoKeywords = new ULocale(locStrBuf.toString());\r
-\r
- Calendar cal = Calendar.getInstance(testLocales[i]);\r
-\r
- // Calendar getDateFormat method\r
- DateFormat df = cal.getDateTimeFormat(DateFormat.MEDIUM, DateFormat.MEDIUM, locNoKeywords);\r
- if (df instanceof SimpleDateFormat) {\r
- formatters[0] = (SimpleDateFormat)df;\r
- formatters[0].applyPattern(testPattern);\r
- } else {\r
- formatters[0] = null;\r
- }\r
-\r
- // DateFormat constructor with locale\r
- df = DateFormat.getDateInstance(DateFormat.MEDIUM, testLocales[i]);\r
- if (df instanceof SimpleDateFormat) {\r
- formatters[1] = (SimpleDateFormat)df;\r
- formatters[1].applyPattern(testPattern);\r
- } else {\r
- formatters[1] = null;\r
- }\r
-\r
- // DateFormat constructor with Calendar\r
- df = DateFormat.getDateInstance(cal, DateFormat.MEDIUM, locNoKeywords);\r
- if (df instanceof SimpleDateFormat) {\r
- formatters[2] = (SimpleDateFormat)df;\r
- formatters[2].applyPattern(testPattern);\r
- } else {\r
- formatters[2] = null;\r
- }\r
-\r
- // SimpleDateFormat constructor\r
- formatters[3] = new SimpleDateFormat(testPattern, testLocales[i]);\r
- \r
- // SimpleDateFormat with DateFormatSymbols\r
- DateFormatSymbols dfs = new DateFormatSymbols(testLocales[i]);\r
- formatters[4] = new SimpleDateFormat(testPattern, dfs, testLocales[i]);\r
-\r
- // All SimpleDateFormat instances should produce the exact\r
- // same result.\r
- String expected = null;\r
- Date d = new Date();\r
- for (int j = 0; j < formatters.length; j++) {\r
- if (formatters[j] != null) {\r
- String tmp = formatters[j].format(d);\r
- if (expected == null) {\r
- expected = tmp;\r
- } else if (!expected.equals(tmp)) {\r
- errln("FAIL: formatter[" + j + "] returned \"" + tmp + "\" in locale " +\r
- testLocales[i] + " - expected: " + expected);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- /*\r
- * Test for format/parse method with calendar which is different\r
- * from what DateFormat instance internally use. See ticket#6420.\r
- */\r
- public void TestRoundtripWithCalendar() {\r
- TimeZone tz = TimeZone.getTimeZone("Europe/Paris");\r
- TimeZone gmt = TimeZone.getTimeZone("Etc/GMT");\r
-\r
- final Calendar[] calendars = {\r
- new GregorianCalendar(tz),\r
- new BuddhistCalendar(tz),\r
- new HebrewCalendar(tz),\r
- new IslamicCalendar(tz),\r
- new JapaneseCalendar(tz),\r
- };\r
-\r
- final String pattern = "GyMMMMdEEEEHHmmssVVVV";\r
-\r
- //FIXME The formatters commented out below are currently failing because of\r
- // the calendar calculation problem reported by #6691\r
-\r
- // The order of test formatters mus match the order of calendars above.\r
- final DateFormat[] formatters = {\r
- DateFormat.getPatternInstance(pattern, new ULocale("en_US")), //calendar=gregorian\r
- DateFormat.getPatternInstance(pattern, new ULocale("th_TH")), //calendar=buddhist\r
- DateFormat.getPatternInstance(pattern, new ULocale("he_IL@calendar=hebrew")),\r
-// DateFormat.getPatternInstance(pattern, new ULocale("ar_EG@calendar=islamic")),\r
-// DateFormat.getPatternInstance(pattern, new ULocale("ja_JP@calendar=japanese")),\r
- };\r
-\r
- Date d = new Date();\r
- StringBuffer buf = new StringBuffer();\r
- FieldPosition fpos = new FieldPosition(0);\r
- ParsePosition ppos = new ParsePosition(0);\r
-\r
- for (int i = 0; i < formatters.length; i++) {\r
- buf.setLength(0);\r
- fpos.setBeginIndex(0);\r
- fpos.setEndIndex(0);\r
- calendars[i].setTime(d);\r
-\r
- // Normal case output - the given calendar matches the calendar\r
- // used by the formatter\r
- formatters[i].format(calendars[i], buf, fpos);\r
- String refStr = buf.toString();\r
-\r
- for (int j = 0; j < calendars.length; j++) {\r
- if (j == i) {\r
- continue;\r
- }\r
- buf.setLength(0);\r
- fpos.setBeginIndex(0);\r
- fpos.setEndIndex(0);\r
- calendars[j].setTime(d);\r
-\r
- // Even the different calendar type is specified,\r
- // we should get the same result.\r
- formatters[i].format(calendars[j], buf, fpos);\r
- if (!refStr.equals(buf.toString())) {\r
- errln("FAIL: Different format result with a different calendar for the same time -"\r
- + "\n Reference calendar type=" + calendars[i].getType()\r
- + "\n Another calendar type=" + calendars[j].getType()\r
- + "\n Expected result=" + refStr\r
- + "\n Actual result=" + buf.toString());\r
- }\r
- }\r
-\r
- calendars[i].setTimeZone(gmt);\r
- calendars[i].clear();\r
- ppos.setErrorIndex(-1);\r
- ppos.setIndex(0);\r
-\r
- // Normal case parse result - the given calendar matches the calendar\r
- // used by the formatter\r
- formatters[i].parse(refStr, calendars[i], ppos);\r
-\r
- for (int j = 0; j < calendars.length; j++) {\r
- if (j == i) {\r
- continue;\r
- }\r
- calendars[j].setTimeZone(gmt);\r
- calendars[j].clear();\r
- ppos.setErrorIndex(-1);\r
- ppos.setIndex(0);\r
-\r
- // Even the different calendar type is specified,\r
- // we should get the same time and time zone.\r
- formatters[i].parse(refStr, calendars[j], ppos);\r
- if (calendars[i].getTimeInMillis() != calendars[j].getTimeInMillis()\r
- || !calendars[i].getTimeZone().equals(calendars[j].getTimeZone())) {\r
- errln("FAIL: Different parse result with a different calendar for the same string -"\r
- + "\n Reference calendar type=" + calendars[i].getType()\r
- + "\n Another calendar type=" + calendars[j].getType()\r
- + "\n Date string=" + refStr\r
- + "\n Expected time=" + calendars[i].getTimeInMillis()\r
- + "\n Expected time zone=" + calendars[i].getTimeZone().getID()\r
- + "\n Actual time=" + calendars[j].getTimeInMillis()\r
- + "\n Actual time zone=" + calendars[j].getTimeZone().getID());\r
- }\r
- }\r
- }\r
- }\r
-\r
- // based on TestRelativeDateFormat() in icu/trunk/source/test/cintltst/cdattst.c\r
- public void TestRelativeDateFormat() {\r
- ULocale loc = ULocale.US;\r
- TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");\r
- Calendar cal = new GregorianCalendar(tz, loc);\r
- Date now = new Date();\r
- cal.setTime(now);\r
- cal.set(Calendar.HOUR_OF_DAY, 18);\r
- cal.set(Calendar.MINUTE, 49);\r
- cal.set(Calendar.SECOND, 0);\r
- Date today = cal.getTime();\r
- String minutesStr = "49"; // minutes string to search for in formatted result\r
- int[] dateStylesList = { DateFormat.RELATIVE_FULL, DateFormat.RELATIVE_LONG, DateFormat.RELATIVE_MEDIUM, DateFormat.RELATIVE_SHORT };\r
-\r
- for (int i = 0; i < dateStylesList.length; i++) {\r
- int dateStyle = dateStylesList[i];\r
- DateFormat fmtRelDateTime = DateFormat.getDateTimeInstance(dateStyle, DateFormat.SHORT, loc);\r
- DateFormat fmtRelDate = DateFormat.getDateInstance(dateStyle, loc);\r
- DateFormat fmtTime = DateFormat.getTimeInstance(DateFormat.SHORT, loc);\r
-\r
- for (int dayOffset = -2; dayOffset <= 2; dayOffset++ ) {\r
- StringBuffer dateTimeStr = new StringBuffer(64);\r
- StringBuffer dateStr = new StringBuffer(64);\r
- StringBuffer timeStr = new StringBuffer(64);\r
- FieldPosition fp = new FieldPosition(DateFormat.MINUTE_FIELD);\r
- cal.setTime(today);\r
- cal.add(Calendar.DATE, dayOffset);\r
-\r
- fmtRelDateTime.format(cal, dateTimeStr, fp);\r
- fmtRelDate.format(cal, dateStr, new FieldPosition(0) );\r
- fmtTime.format(cal, timeStr, new FieldPosition(0) );\r
-\r
- // check that dateStr is in dateTimeStr\r
- if ( dateTimeStr.toString().indexOf( dateStr.toString() ) < 0 ) {\r
- errln("relative date string not found in datetime format with timeStyle SHORT, dateStyle " +\r
- dateStyle + " for dayOffset " + dayOffset );\r
- errln("datetime format is " + dateTimeStr.toString() + ", date string is " + dateStr.toString() );\r
- }\r
- // check that timeStr is in dateTimeStr\r
- if ( dateTimeStr.toString().indexOf( timeStr.toString() ) < 0 ) {\r
- errln("short time string not found in datetime format with timeStyle SHORT, dateStyle " +\r
- dateStyle + " for dayOffset " + dayOffset );\r
- errln("datetime format is " + dateTimeStr.toString() + ", time string is " + timeStr.toString() );\r
- }\r
- // check index of minutesStr\r
- int minutesStrIndex = dateTimeStr.toString().indexOf( minutesStr );\r
- if ( fp.getBeginIndex() != minutesStrIndex ) {\r
- errln("FieldPosition beginIndex " + fp.getBeginIndex() + " instead of " + minutesStrIndex + " for datetime format with timeStyle SHORT, dateStyle " +\r
- dateStyle + " for dayOffset " + dayOffset );\r
- errln("datetime format is " + dateTimeStr.toString() );\r
- }\r
- }\r
- }\r
- }\r
-\r
- public void Test6880() {\r
- Date d1, d2, dp1, dp2, dexp1, dexp2;\r
- String s1, s2;\r
-\r
- TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");\r
- GregorianCalendar gcal = new GregorianCalendar(tz);\r
-\r
- gcal.clear();\r
- gcal.set(1910, Calendar.JANUARY, 1, 12, 00); // offset 8:05:52\r
- d1 = gcal.getTime();\r
-\r
- gcal.clear();\r
- gcal.set(1950, Calendar.JANUARY, 1, 12, 00); // offset 8:00\r
- d2 = gcal.getTime();\r
-\r
- gcal.clear();\r
- gcal.set(1970, Calendar.JANUARY, 1, 12, 00);\r
- dexp2 = gcal.getTime();\r
- dexp1 = new Date(dexp2.getTime() - (5*60 + 52)*1000); // subtract 5m52s\r
-\r
- DateFormat fmt = DateFormat.getTimeInstance(DateFormat.FULL, new ULocale("zh"));\r
- fmt.setTimeZone(tz);\r
-\r
- s1 = fmt.format(d1);\r
- s2 = fmt.format(d2);\r
-\r
- try {\r
- dp1 = fmt.parse(s1);\r
- dp2 = fmt.parse(s2);\r
-\r
- if (!dp1.equals(dexp1)) {\r
- errln("FAIL: Failed to parse " + s1 + " parsed: " + dp1 + " expected: " + dexp1);\r
- }\r
- if (!dp2.equals(dexp2)) {\r
- errln("FAIL: Failed to parse " + s2 + " parsed: " + dp2 + " expected: " + dexp2);\r
- }\r
- } catch (ParseException pe) {\r
- errln("FAIL: Parse failure");\r
- }\r
- }\r
-}\r
+//##header J2SE15
+/*
+ *******************************************************************************
+ * Copyright (C) 2001-2009, International Business Machines Corporation and *
+ * others. All Rights Reserved. *
+ *******************************************************************************
+ */
+
+/**
+ * Port From: ICU4C v1.8.1 : format : DateFormatTest
+ * Source File: $ICU4CRoot/source/test/intltest/dtfmttst.cpp
+ **/
+
+package com.ibm.icu.dev.test.format;
+
+import java.text.AttributedCharacterIterator;
+import java.text.CharacterIterator;
+import java.text.FieldPosition;
+import java.text.ParseException;
+import java.text.ParsePosition;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.ibm.icu.impl.ICUResourceBundle;
+import com.ibm.icu.text.ChineseDateFormat;
+import com.ibm.icu.text.ChineseDateFormatSymbols;
+import com.ibm.icu.text.DateFormat;
+import com.ibm.icu.text.DateFormatSymbols;
+import com.ibm.icu.text.NumberFormat;
+import com.ibm.icu.text.SimpleDateFormat;
+import com.ibm.icu.util.BuddhistCalendar;
+import com.ibm.icu.util.Calendar;
+import com.ibm.icu.util.ChineseCalendar;
+import com.ibm.icu.util.GregorianCalendar;
+import com.ibm.icu.util.HebrewCalendar;
+import com.ibm.icu.util.IslamicCalendar;
+import com.ibm.icu.util.JapaneseCalendar;
+import com.ibm.icu.util.TimeZone;
+import com.ibm.icu.util.ULocale;
+import com.ibm.icu.util.UResourceBundle;
+import com.ibm.icu.util.VersionInfo;
+
+public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
+
+ public static void main(String[] args) throws Exception {
+ new DateFormatTest().run(args);
+ }
+
+ /**
+ * Verify that patterns have the correct values and could produce the
+ * the DateFormat instances that contain the correct localized patterns.
+ */
+ public void TestPatterns() {
+ final String[][] EXPECTED = {
+ {DateFormat.MINUTE_SECOND, "ms", "en", "m:s"},
+ {DateFormat.HOUR24_MINUTE, "Hm", "en", "H:m"},
+ {DateFormat.HOUR24_MINUTE_SECOND, "Hms","en","H:m:s"},
+ {DateFormat.HOUR_MINUTE, "hm","en","h:m a"},
+ {DateFormat.HOUR_MINUTE_SECOND, "hms","en","h:m:s a"},
+ {DateFormat.DAY, "d","en","d"},
+ {DateFormat.STANDALONE_MONTH, "LLLL","en","LLLL"},
+ {DateFormat.ABBR_STANDALONE_MONTH, "LLL","en","LLL"},
+ {DateFormat.YEAR, "y","en","y"},
+ {DateFormat.MONTH_DAY, "MMMMd","en","MMMM d"},
+ {DateFormat.ABBR_MONTH_DAY, "MMMd","en","MMM d"},
+ {DateFormat.NUM_MONTH_DAY, "Md","en","M/d"},
+ {DateFormat.MONTH_WEEKDAY_DAY, "MMMMEEEEd","en","EEEE, MMMM d"},
+ {DateFormat.ABBR_MONTH_WEEKDAY_DAY, "MMMEd","en","E, MMM d"},
+ {DateFormat.NUM_MONTH_WEEKDAY_DAY, "MEd","en","E, M/d"},
+ {DateFormat.YEAR_MONTH, "yMMMM","en","MMMM y"},
+ {DateFormat.YEAR_ABBR_MONTH, "yMMM","en","MMM y"},
+ {DateFormat.YEAR_NUM_MONTH, "yM","en","M/y"},
+ {DateFormat.YEAR_ABBR_MONTH_WEEKDAY_DAY, "yMMMEd", "en", "E, MMM d, y"},
+ {DateFormat.YEAR_NUM_MONTH_WEEKDAY_DAY, "yMEd", "en", "E, M/d/y"},
+ {DateFormat.YEAR_QUARTER, "yQQQ", "en", "QQQ y"},
+ {DateFormat.YEAR_ABBR_QUARTER, "yQ", "en", "Q y"}
+ };
+
+ for (int i = 0; i < EXPECTED.length; i++) {
+
+ // Verify that patterns have the correct values
+ String actualPattern = EXPECTED[i][0];
+ String expectedPattern = EXPECTED[i][1];
+ ULocale locale = new ULocale(EXPECTED[i][2], "", "");
+ if (!actualPattern.equals(expectedPattern)) {
+ errln("FAILURE! Expected pattern: " + expectedPattern +
+ " but was: " + actualPattern);
+ }
+
+ // Verify that DataFormat instances produced contain the correct
+ // localized patterns
+ DateFormat date1 = DateFormat.getPatternInstance(actualPattern,
+ locale);
+ DateFormat date2 = DateFormat.getPatternInstance(Calendar.getInstance(locale),
+ actualPattern, locale);
+
+ String expectedLocalPattern = EXPECTED[i][3];
+ String actualLocalPattern1 = ((SimpleDateFormat)date1).toLocalizedPattern();
+ String actualLocalPattern2 = ((SimpleDateFormat)date2).toLocalizedPattern();
+ if (!actualLocalPattern1.equals(expectedLocalPattern)) {
+ errln("FAILURE! Expected local pattern: " + expectedLocalPattern
+ + " but was: " + actualLocalPattern1);
+ }
+ if (!actualLocalPattern2.equals(expectedLocalPattern)) {
+ errln("FAILURE! Expected local pattern: " + expectedLocalPattern
+ + " but was: " + actualLocalPattern2);
+ }
+ }
+ }
+
+ // Test written by Wally Wedel and emailed to me.
+ public void TestWallyWedel() {
+ /*
+ * Instantiate a TimeZone so we can get the ids.
+ */
+ //TimeZone tz = new SimpleTimeZone(7, ""); //The variable is never used
+ /*
+ * Computational variables.
+ */
+ int offset, hours, minutes, seconds;
+ /*
+ * Instantiate a SimpleDateFormat set up to produce a full time
+ zone name.
+ */
+ SimpleDateFormat sdf = new SimpleDateFormat("zzzz");
+ /*
+ * A String array for the time zone ids.
+ */
+
+ final String[] ids = TimeZone.getAvailableIDs();
+ int ids_length = ids.length; //when fixed the bug should comment it out
+
+ /*
+ * How many ids do we have?
+ */
+ logln("Time Zone IDs size:" + ids_length);
+ /*
+ * Column headings (sort of)
+ */
+ logln("Ordinal ID offset(h:m) name");
+ /*
+ * Loop through the tzs.
+ */
+ Date today = new Date();
+ Calendar cal = Calendar.getInstance();
+ for (int i = 0; i < ids_length; i++) {
+ logln(i + " " + ids[i]);
+ TimeZone ttz = TimeZone.getTimeZone(ids[i]);
+ // offset = ttz.getRawOffset();
+ cal.setTimeZone(ttz);
+ cal.setTime(today);
+ offset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET);
+ // logln(i + " " + ids[i] + " offset " + offset);
+ String sign = "+";
+ if (offset < 0) {
+ sign = "-";
+ offset = -offset;
+ }
+ hours = offset / 3600000;
+ minutes = (offset % 3600000) / 60000;
+ seconds = (offset % 60000) / 1000;
+ String dstOffset = sign + (hours < 10 ? "0" : "") + hours
+ + ":" + (minutes < 10 ? "0" : "") + minutes;
+ if (seconds != 0) {
+ dstOffset += ":" + (seconds < 10 ? "0" : "") + seconds;
+ }
+ /*
+ * Instantiate a date so we can display the time zone name.
+ */
+ sdf.setTimeZone(ttz);
+ /*
+ * Format the output.
+ */
+ StringBuffer fmtOffset = new StringBuffer("");
+ FieldPosition pos = new FieldPosition(0);
+
+ try {
+ fmtOffset = sdf.format(today, fmtOffset, pos);
+ } catch (Exception e) {
+ logln("Exception:" + e);
+ continue;
+ }
+ // UnicodeString fmtOffset = tzS.toString();
+ String fmtDstOffset = null;
+ if (fmtOffset.toString().startsWith("GMT")) {
+ //fmtDstOffset = fmtOffset.substring(3);
+ fmtDstOffset = fmtOffset.substring(3, fmtOffset.length());
+ }
+ /*
+ * Show our result.
+ */
+
+ boolean ok = fmtDstOffset == null || fmtDstOffset.equals("") || fmtDstOffset.equals(dstOffset);
+ if (ok) {
+ logln(i + " " + ids[i] + " " + dstOffset + " "
+ + fmtOffset + (fmtDstOffset != null ? " ok" : " ?"));
+ } else {
+ errln(i + " " + ids[i] + " " + dstOffset + " " + fmtOffset + " *** FAIL ***");
+ }
+
+ }
+ }
+
+ public void TestEquals() {
+ DateFormat fmtA = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL);
+ DateFormat fmtB = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL);
+ if (!fmtA.equals(fmtB))
+ errln("FAIL");
+ }
+
+ /**
+ * Test the parsing of 2-digit years.
+ */
+ public void TestTwoDigitYearDSTParse() {
+
+ SimpleDateFormat fullFmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss.SSS zzz yyyy G");
+ SimpleDateFormat fmt = new SimpleDateFormat("dd-MMM-yy h:mm:ss 'o''clock' a z", Locale.ENGLISH);
+ String s = "03-Apr-04 2:20:47 o'clock AM PST";
+
+ /*
+ * SimpleDateFormat(pattern, locale) Construct a SimpleDateDateFormat using
+ * the given pattern, the locale and using the TimeZone.getDefault();
+ * So it need to add the timezone offset on hour field.
+ * ps. the Method Calendar.getTime() used by SimpleDateFormat.parse() always
+ * return Date value with TimeZone.getDefault() [Richard/GCL]
+ */
+
+ TimeZone defaultTZ = TimeZone.getDefault();
+ TimeZone PST = TimeZone.getTimeZone("PST");
+ int defaultOffset = defaultTZ.getRawOffset();
+ int PSTOffset = PST.getRawOffset();
+ int hour = 2 + (defaultOffset - PSTOffset) / (60*60*1000);
+ // hour is the expected hour of day, in units of seconds
+ hour = ((hour < 0) ? hour + 24 : hour) * 60*60;
+ try {
+ Date d = fmt.parse(s);
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ //DSTOffset
+ hour += defaultTZ.inDaylightTime(d) ? 1 : 0;
+
+ logln(s + " P> " + ((DateFormat) fullFmt).format(d));
+ // hr is the actual hour of day, in units of seconds
+ // adjust for DST
+ int hr = cal.get(Calendar.HOUR_OF_DAY) * 60*60 -
+ cal.get(Calendar.DST_OFFSET) / 1000;
+ if (hr != hour)
+ errln("FAIL: Hour (-DST) = " + hr / (60*60.0)+
+ "; expected " + hour / (60*60.0));
+ } catch (ParseException e) {
+ errln("Parse Error:" + e.getMessage());
+ }
+
+ }
+
+ /**
+ * Verify that returned field position indices are correct.
+ */
+ public void TestFieldPosition() {
+ int i, j, exp;
+ StringBuffer buf = new StringBuffer();
+
+ // Verify data
+ if (VersionInfo.ICU_VERSION.compareTo(VersionInfo.getInstance(3, 7)) >= 0) {
+ DateFormatSymbols rootSyms = new DateFormatSymbols(new Locale("", "", ""));
+ assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars());
+ }
+
+ assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES.length == DateFormat.FIELD_COUNT);
+ if(DateFormat.FIELD_COUNT != PATTERN_CHARS.length()){
+ errln("Did not get the correct value for DateFormat.FIELD_COUNT. Expected: "+ PATTERN_CHARS.length());
+ }
+
+ // Create test formatters
+ final int COUNT = 4;
+ DateFormat[] dateFormats = new DateFormat[COUNT];
+ dateFormats[0] = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US);
+ dateFormats[1] = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.FRANCE);
+ // Make the pattern "G y M d..."
+ buf.append(PATTERN_CHARS);
+ for (j=buf.length()-1; j>=0; --j) buf.insert(j, ' ');
+ dateFormats[2] = new SimpleDateFormat(buf.toString(), Locale.US);
+ // Make the pattern "GGGG yyyy MMMM dddd..."
+ for (j=buf.length()-1; j>=0; j-=2) {
+ for (i=0; i<3; ++i) {
+ buf.insert(j, buf.charAt(j));
+ }
+ }
+ dateFormats[3] = new SimpleDateFormat(buf.toString(), Locale.US);
+
+ Date aug13 = new Date((long) 871508052513.0);
+
+ // Expected output field values for above DateFormats on aug13
+ // Fields are given in order of DateFormat field number
+ final String EXPECTED[] = {
+ "", "1997", "August", "13", "", "", "34", "12", "",
+ "Wednesday", "", "", "", "", "PM", "2", "", "Pacific Daylight Time", "", "", "", "", "", "", "","","","","","",
+
+ "", "1997", "ao\u00FBt", "13", "", "14", "34", "12", "",
+ "mercredi", "", "", "", "", "", "", "", "heure avanc\u00E9e du Pacifique", "", "", "", "", "", "", "","","","","","",
+
+ "AD", "1997", "8", "13", "14", "14", "34", "12", "5",
+ "Wed", "225", "2", "33", "2", "PM", "2", "2", "PDT", "1997", "4", "1997", "2450674", "52452513", "-0700", "PT","4","8","3","3","PDT",
+
+ "Anno Domini", "1997", "August", "0013", "0014", "0014", "0034", "0012", "5130",
+ "Wednesday", "0225", "0002", "0033", "0002", "PM", "0002", "0002", "Pacific Daylight Time", "1997",
+ "Wednesday", "1997", "2450674", "52452513", "GMT-07:00", "Pacific Time","Wednesday","August", "3rd quarter", "3rd quarter","United States (Los Angeles)",
+ };
+
+ assertTrue("data size", EXPECTED.length == COUNT * DateFormat.FIELD_COUNT);
+
+//#if defined(FOUNDATION10) || defined(J2SE13)
+//#else
+ final DateFormat.Field[] DTFMT_FIELDS = {
+ DateFormat.Field.AM_PM,
+ DateFormat.Field.DAY_OF_MONTH,
+ DateFormat.Field.DAY_OF_WEEK,
+ DateFormat.Field.DAY_OF_WEEK_IN_MONTH,
+ DateFormat.Field.DAY_OF_YEAR,
+
+ DateFormat.Field.DOW_LOCAL,
+ DateFormat.Field.ERA,
+ DateFormat.Field.EXTENDED_YEAR,
+ DateFormat.Field.HOUR_OF_DAY0,
+ DateFormat.Field.HOUR_OF_DAY1,
+
+ DateFormat.Field.HOUR0,
+ DateFormat.Field.HOUR1,
+ DateFormat.Field.JULIAN_DAY,
+ DateFormat.Field.MILLISECOND,
+ DateFormat.Field.MILLISECONDS_IN_DAY,
+
+ DateFormat.Field.MINUTE,
+ DateFormat.Field.MONTH,
+ DateFormat.Field.QUARTER,
+ DateFormat.Field.SECOND,
+ DateFormat.Field.TIME_ZONE,
+
+ DateFormat.Field.WEEK_OF_MONTH,
+ DateFormat.Field.WEEK_OF_YEAR,
+ DateFormat.Field.YEAR,
+ DateFormat.Field.YEAR_WOY,
+ };
+
+ final String[][] EXPECTED_BY_FIELD = {
+ {"PM", "13", "Wednesday", "", "",
+ "", "", "", "", "",
+ "", "2", "", "", "",
+ "34", "August", "", "12", "Pacific Daylight Time",
+ "", "", "1997", ""},
+
+ {"", "13", "mercredi", "", "",
+ "", "", "", "14", "",
+ "", "", "", "", "",
+ "34", "ao\u00FBt", "", "12", "heure avanc\u00E9e du Pacifique",
+ "", "", "1997", ""},
+
+ {"PM", "13", "Wed", "2", "225",
+ "4", "AD", "1997", "14", "14",
+ "2", "2", "2450674", "5", "52452513",
+ "34", "8", "3", "12", "PDT",
+ "2", "33", "1997", "1997"},
+
+ {"PM", "0013", "Wednesday", "0002", "0225",
+ "Wednesday", "Anno Domini", "1997", "0014", "0014",
+ "0002", "0002", "2450674", "5130", "52452513",
+ "0034", "August", "3rd quarter", "0012", "Pacific Daylight Time",
+ "0002", "0033", "1997", "1997"},
+ };
+//#endif
+
+ TimeZone PT = TimeZone.getTimeZone("America/Los_Angeles");
+ for (j = 0, exp = 0; j < COUNT; ++j) {
+ // String str;
+ DateFormat df = dateFormats[j];
+ df.setTimeZone(PT);
+ logln(" Pattern = " + ((SimpleDateFormat) df).toPattern());
+ try {
+ logln(" Result = " + df.format(aug13));
+ } catch (Exception e) {
+ errln("FAIL: " + e);
+ e.printStackTrace();
+ continue;
+ }
+
+ FieldPosition pos;
+ String field;
+
+ for (i = 0; i < DateFormat.FIELD_COUNT; ++i, ++exp) {
+ pos = new FieldPosition(i);
+ buf.setLength(0);
+ df.format(aug13, buf, pos);
+ field = buf.substring(pos.getBeginIndex(), pos.getEndIndex());
+ assertEquals("pattern#" + j + " field #" + i + " " + DATEFORMAT_FIELD_NAMES[i],
+ EXPECTED[exp], field);
+ }
+
+//#if defined(FOUNDATION10) || defined(J2SE13)
+//#else
+ // FieldPostion initialized by DateFormat.Field trac#6089
+ for(i = 0; i < DTFMT_FIELDS.length; i++) {
+ // The format method only set position for the first occurrence of
+ // the specified field.
+ pos = new FieldPosition(DTFMT_FIELDS[i]);
+ buf.setLength(0);
+ df.format(aug13, buf, pos);
+ field = buf.substring(pos.getBeginIndex(), pos.getEndIndex());
+ assertEquals("pattern#" + j + " " + DTFMT_FIELDS[i].toString(), EXPECTED_BY_FIELD[j][i], field);
+ }
+//#endif
+ }
+ }
+ /**
+ * This MUST be kept in sync with DateFormatSymbols.patternChars.
+ */
+ static final String PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqV";
+
+//#if defined(FOUNDATION10) || defined(J2SE13)
+//#else
+ /**
+ * A list of the DateFormat.Field.
+ * This MUST be kept in sync with PATTERN_CHARS above.
+ */
+ static final DateFormat.Field[] DATEFORMAT_FIELDS = {
+ DateFormat.Field.ERA, // G
+ DateFormat.Field.YEAR, // y
+ DateFormat.Field.MONTH, // M
+ DateFormat.Field.DAY_OF_MONTH, // d
+ DateFormat.Field.HOUR_OF_DAY1, // k
+ DateFormat.Field.HOUR_OF_DAY0, // H
+ DateFormat.Field.MINUTE, // m
+ DateFormat.Field.SECOND, // s
+ DateFormat.Field.MILLISECOND, // S
+ DateFormat.Field.DAY_OF_WEEK, // E
+ DateFormat.Field.DAY_OF_YEAR, // D
+ DateFormat.Field.DAY_OF_WEEK_IN_MONTH, // F
+ DateFormat.Field.WEEK_OF_YEAR, // w
+ DateFormat.Field.WEEK_OF_MONTH, // W
+ DateFormat.Field.AM_PM, // a
+ DateFormat.Field.HOUR1, // h
+ DateFormat.Field.HOUR0, // K
+ DateFormat.Field.TIME_ZONE, // z
+ DateFormat.Field.YEAR_WOY, // Y
+ DateFormat.Field.DOW_LOCAL, // e
+ DateFormat.Field.EXTENDED_YEAR, // u
+ DateFormat.Field.JULIAN_DAY, // g
+ DateFormat.Field.MILLISECONDS_IN_DAY, // A
+ DateFormat.Field.TIME_ZONE, // Z
+ DateFormat.Field.TIME_ZONE, // v
+ DateFormat.Field.DAY_OF_WEEK, // c
+ DateFormat.Field.MONTH, // L
+ DateFormat.Field.QUARTER, // Q
+ DateFormat.Field.QUARTER, // q
+ DateFormat.Field.TIME_ZONE, // V
+ };
+//#endif
+
+ /**
+ * A list of the names of all the fields in DateFormat.
+ * This MUST be kept in sync with DateFormat.
+ */
+ static final String DATEFORMAT_FIELD_NAMES[] = {
+ "ERA_FIELD",
+ "YEAR_FIELD",
+ "MONTH_FIELD",
+ "DATE_FIELD",
+ "HOUR_OF_DAY1_FIELD",
+ "HOUR_OF_DAY0_FIELD",
+ "MINUTE_FIELD",
+ "SECOND_FIELD",
+ "MILLISECOND_FIELD",
+ "DAY_OF_WEEK_FIELD",
+ "DAY_OF_YEAR_FIELD",
+ "DAY_OF_WEEK_IN_MONTH_FIELD",
+ "WEEK_OF_YEAR_FIELD",
+ "WEEK_OF_MONTH_FIELD",
+ "AM_PM_FIELD",
+ "HOUR1_FIELD",
+ "HOUR0_FIELD",
+ "TIMEZONE_FIELD",
+ "YEAR_WOY_FIELD",
+ "DOW_LOCAL_FIELD",
+ "EXTENDED_YEAR_FIELD",
+ "JULIAN_DAY_FIELD",
+ "MILLISECONDS_IN_DAY_FIELD",
+ "TIMEZONE_RFC_FIELD",
+ "GENERIC_TIMEZONE_FIELD",
+ "STAND_ALONE_DAY_FIELD",
+ "STAND_ALONE_MONTH_FIELD",
+ "QUARTER_FIELD",
+ "STAND_ALONE_QUARTER_FIELD",
+ "TIMEZONE_SPECIAL_FIELD",
+ };
+
+ /**
+ * General parse/format tests. Add test cases as needed.
+ */
+ public void TestGeneral() {
+
+ String DATA[] = {
+ "yyyy MM dd HH:mm:ss.SSS",
+
+ // Milliseconds are left-justified, since they format as fractions of a second
+ // Both format and parse should round HALF_UP
+ "y/M/d H:mm:ss.S", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.6", "2004 03 10 16:36:31.600",
+ "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.57", "2004 03 10 16:36:31.570",
+ "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567",
+ "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.568", "2004/3/10 16:36:31.5680",
+ };
+ expect(DATA, new Locale("en", "", ""));
+ }
+
+ public void TestGenericTime() {
+
+
+ // any zone pattern should parse any zone
+ Locale en = new Locale("en", "", "");
+ String ZDATA[] = {
+ "yyyy MM dd HH:mm zzz",
+ // round trip
+ "y/M/d H:mm zzzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Standard Time",
+ "y/M/d H:mm zzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",
+ "y/M/d H:mm vvvv", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",
+ "y/M/d H:mm v", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PT",
+ // non-generic timezone string influences dst offset even if wrong for date/time
+ "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 PST",
+ "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 Pacific Time",
+ "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 PDT",
+ "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 Pacific Time",
+ // generic timezone generates dst offset appropriate for local time
+ "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",
+ "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",
+ "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT",
+ "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time",
+ // daylight savings time transition edge cases.
+ // time to parse does not really exist, PT interpreted as earlier time
+ "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT",
+ "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT",
+ "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PST",
+ "y/M/d H:mm v", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT",
+ "y/M/d H:mm v", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT",
+ "y/M/d H:mm v", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PT",
+ "y/M/d H:mm", "pf", "2005/4/3 2:30", "2005 04 03 03:30 PDT", "2005/4/3 3:30",
+ // time to parse is ambiguous, PT interpreted as later time
+ "y/M/d H:mm zzz", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PST",
+ "y/M/d H:mm v", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PT",
+ "y/M/d H:mm", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30",
+
+ "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST",
+ "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST",
+ "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PDT",
+ "y/M/d H:mm v", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT",
+ "y/M/d H:mm v", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT",
+ "y/M/d H:mm v", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PT",
+ "y/M/d H:mm", "pf", "2004/10/31 1:30", "2004 10 31 01:30 PST", "2004/10/31 1:30",
+ // Below is actually an invalid test case. See the note in #5910. Disable the case for now.
+ // TODO: Revisit after 3.8
+ //"y/M/d H:mm vvvv", "pf", "2004/10/31 1:30 Argentina Time", "2004 10 30 21:30 PDT", "2004/10/31 1:30 Argentina Time",
+ };
+ expect(ZDATA, en);
+
+ logln("cross format/parse tests");
+ final String basepat = "yy/MM/dd H:mm ";
+ final SimpleDateFormat[] formats = {
+ new SimpleDateFormat(basepat + "v", en),
+ new SimpleDateFormat(basepat + "vvvv", en),
+ new SimpleDateFormat(basepat + "zzz", en),
+ new SimpleDateFormat(basepat + "zzzz", en)
+ };
+
+ final SimpleDateFormat univ = new SimpleDateFormat("yyyy MM dd HH:mm zzz", en);
+ final String[] times = { "2004 01 02 03:04 PST", "2004 07 08 09:10 PDT" };
+ for (int i = 0; i < times.length; ++i) {
+ try {
+ Date d = univ.parse(times[i]);
+ logln("time: " + d);
+ for (int j = 0; j < formats.length; ++j) {
+ String test = formats[j].format(d);
+ logln("test: '" + test + "'");
+ for (int k = 0; k < formats.length; ++k) {
+ try {
+ Date t = formats[k].parse(test);
+ if (!d.equals(t)) {
+ errln("format " + k +
+ " incorrectly parsed output of format " + j +
+ " (" + test + "), returned " +
+ t + " instead of " + d);
+ } else {
+ logln("format " + k + " parsed ok");
+ }
+ }
+ catch (ParseException e) {
+ errln("format " + k +
+ " could not parse output of format " + j +
+ " (" + test + ")");
+ }
+ }
+ }
+ }
+ catch (ParseException e) {
+ errln("univ could not parse: " + times[i]);
+ }
+ }
+
+ }
+
+ public void TestGenericTimeZoneOrder() {
+ // generic times should parse the same no matter what the placement of the time zone string
+ // should work for standard and daylight times
+
+ String XDATA[] = {
+ "yyyy MM dd HH:mm zzz",
+ // standard time, explicit daylight/standard
+ "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",
+ "y/M/d zzz H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 PST 1:00",
+ "zzz y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "PST 2004/1/1 1:00",
+
+ // standard time, generic
+ "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",
+ "y/M/d vvvv H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 Pacific Time 1:00",
+ "vvvv y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "Pacific Time 2004/1/1 1:00",
+
+ // daylight time, explicit daylight/standard
+ "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT",
+ "y/M/d zzz H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 PDT 1:00",
+ "zzz y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "PDT 2004/7/1 1:00",
+
+ // daylight time, generic
+ "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time",
+ "y/M/d vvvv H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 Pacific Time 1:00",
+ "vvvv y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "Pacific Time 2004/7/1 1:00",
+ };
+ Locale en = new Locale("en", "", "");
+ expect(XDATA, en);
+ }
+
+ public void TestTimeZoneDisplayName() {
+ Calendar cal = new GregorianCalendar();
+ SimpleDateFormat testfmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+
+ for (int i = 0; i < fallbackTests.length; ++i) {
+ String[] info = fallbackTests[i];
+ logln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3]);
+
+ long time = 0;
+ try {
+ Date testd = testfmt.parse(info[2]);
+ time = testd.getTime();
+ } catch (ParseException pe) {
+ errln("Failed to parse test date data");
+ continue;
+ }
+ ULocale l = new ULocale(info[0]);
+ TimeZone tz = TimeZone.getTimeZone(info[1]);
+ SimpleDateFormat fmt = new SimpleDateFormat(info[3], l);
+ cal.setTimeInMillis(time);
+ cal.setTimeZone(tz);
+ String result = fmt.format(cal);
+ if (!result.equals(info[4])) {
+ errln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3] + " expected: '" +
+ info[4] + "' but got: '" + result + "'");
+ }
+ }
+ }
+
+ private static final String GMT_BG = "\u0413\u0440\u0438\u0438\u043D\u0443\u0438\u0447";
+ private static final String GMT_ZH = "\u683C\u6797\u5C3C\u6CBB\u6807\u51C6\u65F6\u95F4";
+ //private static final String GMT_BG = "GMT";
+
+ private static final String[][] fallbackTests = {
+ { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
+ { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
+ { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "Pacific Standard Time", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "Pacific Daylight Time", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Pacific Time", "America/Los_Angeles" },
+ { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "United States (Los Angeles)", "America/Los_Angeles" },
+ { "en_GB", "America/Los_Angeles", "2004-01-15T12:00:00Z", "z", "PST", "America/Los_Angeles" },
+ { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
+ { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "z", "MST", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "V", "MST", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "z", "MST", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "V", "MST", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "v", "MST", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "vvvv", "Mountain Standard Time", "America/Phoenix" },
+ { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "VVVV", "United States (Phoenix)", "America/Phoenix" },
+
+ { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },
+ { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
+
+ { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },
+ { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
+
+ { "en", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
+ { "en", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
+ { "en", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
+ { "en", "America/Havana", "2004-01-15T00:00:00Z", "V", "CST (Cuba)", "-5:00" },
+ { "en", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "Cuba Standard Time", "-5:00" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "V", "CDT (Cuba)", "-4:00" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "Cuba Daylight Time", "-4:00" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "v", "Cuba Time", "America/Havana" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Cuba Time", "America/Havana" },
+ { "en", "America/Havana", "2004-07-15T00:00:00Z", "VVVV", "Cuba Time", "America/Havana" },
+
+ { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },
+ { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },
+ { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },
+
+ { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },
+ { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },
+ { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },
+
+ { "en", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
+ { "en", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
+ { "en", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" },
+ { "en", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
+ { "en", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "Greenwich Mean Time", "+0:00" },
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "Europe/London" },
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "Europe/London" },
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "British Summer Time", "Europe/London" },
+ // icu en.txt has exemplar city for this time zone
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "v", "United Kingdom Time", "Europe/London" },
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "United Kingdom Time", "Europe/London" },
+ { "en", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "United Kingdom Time", "Europe/London" },
+
+ { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
+ { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
+
+ // JB#5150
+ { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "V", "IST", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
+ { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "V", "IST", "+05:30" },
+ { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },
+ { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "India Time", "Asia/Calcutta" },
+ { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "India Standard Time", "Asia/Calcutta" },
+
+ // ==========
+
+ { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
+ { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
+ { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },
+ { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },
+ { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
+ { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },
+ { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },
+ { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },
+ { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },
+
+ { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
+ { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
+
+ { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
+ { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
+
+ { "de", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
+ { "de", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
+ { "de", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
+ { "de", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
+ { "de", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
+ { "de", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
+ { "de", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
+ { "de", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
+ { "de", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba", "America/Havana" },
+ { "de", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kuba", "America/Havana" },
+ // added to test proper fallback of country name
+ { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba", "America/Havana" },
+ { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kuba", "America/Havana" },
+
+ { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
+ { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
+ { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },
+ { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },
+
+ { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
+ { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
+ { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },
+ { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },
+
+ { "de", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
+ { "de", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
+ { "de", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
+ { "de", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },
+ { "de", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
+ { "de", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
+ { "de", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
+ { "de", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
+ { "de", "Europe/London", "2004-07-15T00:00:00Z", "v", "Vereinigtes K\u00f6nigreich", "Europe/London" },
+ { "de", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "Vereinigtes K\u00f6nigreich", "Europe/London" },
+
+ { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
+ { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
+
+ // JB#5150
+ { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
+ { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
+ { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
+ { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
+ { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "Indien", "Asia/Calcutta" },
+ { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "Indien", "Asia/Calcutta" },
+
+ // ==========
+
+ { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
+ { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0800", "-8:00" },
+ { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0800", "America/Los_Angeles" },
+ { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4", "America/Los_Angeles" },
+ { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0700", "-7:00" },
+ { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0700", "America/Los_Angeles" },
+ { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4", "America/Los_Angeles" },
+ // icu zh.txt has exemplar city for this time zone
+ { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u7f8e\u56fd (\u6d1b\u6749\u77f6)", "America/Los_Angeles" },
+ { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u7f8e\u56fd\u592a\u5e73\u6d0b\u65f6\u95f4", "America/Los_Angeles" },
+
+ { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },
+ // icu zh.txt does not have info for this time zone
+ { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u963f\u6839\u5ef7 (\u5e03\u5b9c\u8bfa\u65af\u827e\u5229\u65af)", "America/Buenos_Aires" },
+ { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "America/Buenos_Aires" },
+
+ { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "-3:00" },
+ { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u963f\u6839\u5ef7 (\u5e03\u5b9c\u8bfa\u65af\u827e\u5229\u65af)", "America/Buenos_Aires" },
+ { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u963f\u6839\u5ef7\u6807\u51c6\u65f6\u95f4", "America/Buenos_Aires" },
+
+ { "zh", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
+ { "zh", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0500", "-5:00" },
+ { "zh", "America/Havana", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0500", "-5:00" },
+ { "zh", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\u53e4\u5df4\u6807\u51c6\u65f6\u95f4", "-5:00" },
+ { "zh", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
+ { "zh", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0400", "-4:00" },
+ { "zh", "America/Havana", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0400", "-4:00" },
+ { "zh", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\u53e4\u5df4\u590f\u4ee4\u65f6\u95f4", "-4:00" },
+ { "zh", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u53e4\u5df4\u65f6\u95f4", "America/Havana" },
+ { "zh", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u53e4\u5df4\u65f6\u95f4", "America/Havana" },
+
+ { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1100", "+11:00" },
+ { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+1100", "+11:00" },
+ { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u590f\u4ee4\u65f6\u95f4", "+11:00" },
+ { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1000", "+10:00" },
+ { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+1000", "+10:00" },
+ { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4", "+10:00" },
+ { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u6fb3\u5927\u5229\u4e9a (\u6089\u5c3c)", "Australia/Sydney" },
+ { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u65f6\u95f4", "Australia/Sydney" },
+
+ { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1100", "+11:00" },
+ { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+1100", "+11:00" },
+ { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u590f\u4ee4\u65f6\u95f4", "+11:00" },
+ { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+1000", "+10:00" },
+ { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+1000", "+10:00" },
+ { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4", "+10:00" },
+ { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u6fb3\u5927\u5229\u4e9a (\u6089\u5c3c)", "Australia/Sydney" },
+ { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u65f6\u95f4", "Australia/Sydney" },
+
+ { "zh", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
+ { "zh", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0000", "+0:00" },
+ { "zh", "Europe/London", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+0000", "+0:00" },
+ { "zh", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
+ { "zh", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\u683C\u6797\u5C3C\u6CBB\u6807\u51C6\u65F6\u95F4", "+0:00" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0100", "+1:00" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+0100", "+1:00" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "+1:00" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", GMT_ZH+"+0100", "+1:00" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u82f1\u56fd\u65f6\u95f4", "Europe/London" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u82f1\u56fd\u65f6\u95f4", "Europe/London" },
+ { "zh", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\u82f1\u56fd\u65f6\u95f4", "Europe/London" },
+
+ { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", GMT_ZH+"-0300", "-3:00" },
+ { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", GMT_ZH+"-0300", "-3:00" },
+
+ // JB#5150
+ { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0530", "+5:30" },
+ { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", GMT_ZH+"+0530", "+5:30" },
+ { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\u5370\u5ea6\u6807\u51c6\u65f6\u95f4", "+5:30" },
+ { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"+0530", "+5:30" },
+ { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", GMT_ZH+"+0530", "+05:30" },
+ { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\u5370\u5ea6\u6807\u51c6\u65f6\u95f4", "+5:30" },
+ { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\u5370\u5ea6\u65f6\u95f4", "Asia/Calcutta" },
+ { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u5370\u5EA6\u6807\u51c6\u65f6\u95f4", "Asia/Calcutta" },
+
+ // ==========
+
+ { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
+ { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" },
+ { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" },
+ { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" },
+ { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" },
+ { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" },
+ { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" },
+ { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u0938\u0902\u092f\u0941\u0915\u094d\u0924 \u0930\u093e\u091c\u094d\u092f \u0905\u092e\u0947\u0930\u093f\u0915\u093e (\u0932\u094b\u0938 \u090f\u0902\u091c\u093f\u0932\u0947\u0938)", "America/Los_Angeles" },
+ { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u0938\u0902\u092f\u0941\u0915\u094d\u0924 \u0930\u093e\u091c\u094d\u092f \u0905\u092e\u0947\u0930\u093f\u0915\u093e (\u0932\u094b\u0938 \u090f\u0902\u091c\u093f\u0932\u0947\u0938)", "America/Los_Angeles" },
+
+ { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },
+ { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },
+
+ { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },
+ { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0905\u0930\u094d\u091c\u0947\u0928\u094d\u091f\u0940\u0928\u093e (\u092c\u094d\u092f\u0942\u0928\u0938 \u0906\u092f\u0930\u0938)", "America/Buenos_Aires" },
+
+ { "hi", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
+ { "hi", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096b:\u0966\u0966", "-5:00" },
+ { "hi", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u096b:\u0966\u0966", "-5:00" },
+ { "hi", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u096b:\u0966\u0966", "-5:00" },
+ { "hi", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
+ { "hi", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096a:\u0966\u0966", "-4:00" },
+ { "hi", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u096a:\u0966\u0966", "-4:00" },
+ { "hi", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u096a:\u0966\u0966", "-4:00" },
+ { "hi", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u0915\u094d\u092f\u0942\u092c\u093e", "America/Havana" },
+ { "hi", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u0915\u094d\u092f\u0942\u092c\u093e", "America/Havana" },
+
+ { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },
+ { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },
+ { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },
+ { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },
+ { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },
+ { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },
+ { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },
+ { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },
+
+ { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },
+ { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },
+ { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+\u0967\u0967:\u0966\u0966", "+11:00" },
+ { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },
+ { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },
+ { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+\u0967\u0966:\u0966\u0966", "+10:00" },
+ { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },
+ { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u0911\u0938\u094d\u091f\u094d\u0930\u0947\u0932\u093f\u092f\u093e (\u0938\u093f\u0921\u0928\u0940)", "Australia/Sydney" },
+
+ { "hi", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
+ { "hi", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u0966:\u0966\u0966", "+0:00" },
+ { "hi", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+\u0966\u0966:\u0966\u0966", "+0:00" },
+ { "hi", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+\u0966\u0966:\u0966\u0966", "+0:00" },
+ { "hi", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
+ { "hi", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u0967:\u0966\u0966", "+1:00" },
+ { "hi", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+\u0966\u0967:\u0966\u0966", "+1:00" },
+ { "hi", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+\u0966\u0967:\u0966\u0966", "+1:00" },
+ { "hi", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u092C\u094D\u0930\u093F\u0924\u0928", "Europe/London" },
+ { "hi", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u092C\u094D\u0930\u093F\u0924\u0928", "Europe/London" },
+
+ { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+ { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-\u0966\u0969:\u0966\u0966", "-3:00" },
+
+ { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u096B:\u0969\u0966", "+5:30" },
+ { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "IST", "+5:30" },
+ { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\u092D\u093E\u0930\u0924\u0940\u092F \u0938\u092E\u092F", "+5:30" },
+ { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\u0966\u096B:\u0969\u0966", "+5:30" },
+ { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "IST", "+05:30" },
+ { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\u092D\u093E\u0930\u0924\u0940\u092F \u0938\u092E\u092F", "+5:30" },
+ { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IST", "Asia/Calcutta" },
+ { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u092D\u093E\u0930\u0924\u0940\u092F \u0938\u092E\u092F", "Asia/Calcutta" },
+
+ // ==========
+
+ { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
+ { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0800", "-8:00" },
+ { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0800", "America/Los_Angeles" },
+ { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
+ { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u0422\u0438\u0445\u043E\u043E\u043A\u0435\u0430\u043D\u0441\u043A\u0430 \u0447\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430", "America/Los_Angeles" },
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0700", "-7:00" },
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0700", "America/Los_Angeles" },
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u0422\u0438\u0445\u043E\u043E\u043A\u0435\u0430\u043D\u0441\u043A\u0430 \u043B\u044F\u0442\u043D\u0430 \u0447\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430", "America/Los_Angeles" },
+ // icu bg.txt has exemplar city for this time zone
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u0421\u0410\u0429 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" },
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u0421\u0410\u0429 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" },
+ { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\u0421\u0410\u0429 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" },
+
+ { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },
+ { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },
+
+ { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },
+ { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },
+ // icu bg.txt does not have info for this time zone
+ { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },
+ { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0440\u0436\u0435\u043d\u0442\u0438\u043d\u0430 (\u0411\u0443\u0435\u043D\u043E\u0441 \u0410\u0439\u0440\u0435\u0441)", "America/Buenos_Aires" },
+
+ { "bg", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
+ { "bg", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0500", "-5:00" },
+ { "bg", "America/Havana", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0500", "-5:00" },
+ { "bg", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0500", "-5:00" },
+ { "bg", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
+ { "bg", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0400", "-4:00" },
+ { "bg", "America/Havana", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0400", "-4:00" },
+ { "bg", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0400", "-4:00" },
+ { "bg", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u041a\u0443\u0431\u0430", "America/Havana" },
+ { "bg", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u041a\u0443\u0431\u0430", "America/Havana" },
+
+ { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+1100", "+11:00" },
+ { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "z", GMT_BG+"+1100", "+11:00" },
+ { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"+1100", "+11:00" },
+ { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+1000", "+10:00" },
+ { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "z", GMT_BG+"+1000", "+10:00" },
+ { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+1000", "+10:00" },
+ { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },
+ { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },
+
+ { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+1100", "+11:00" },
+ { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", GMT_BG+"+1100", "+11:00" },
+ { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"+1100", "+11:00" },
+ { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+1000", "+10:00" },
+ { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", GMT_BG+"+1000", "+10:00" },
+ { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+1000", "+10:00" },
+ { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },
+ { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u0410\u0432\u0441\u0442\u0440\u0430\u043b\u0438\u044f (\u0421\u0438\u0434\u043D\u0438)", "Australia/Sydney" },
+
+ { "bg", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
+ { "bg", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+0000", "+0:00" },
+ { "bg", "Europe/London", "2004-01-15T00:00:00Z", "z", GMT_BG+"+0000", "+0:00" },
+ { "bg", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\u0427\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430 \u0413\u0440\u0438\u043D\u0443\u0438\u0447", "+0:00" },
+ { "bg", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
+ { "bg", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+0100", "+1:00" },
+ { "bg", "Europe/London", "2004-07-15T00:00:00Z", "z", GMT_BG+"+0100", "+1:00" },
+ { "bg", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+0100", "+1:00" },
+ { "bg", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u041e\u0431\u0435\u0434\u0438\u043d\u0435\u043d\u043e \u043a\u0440\u0430\u043b\u0441\u0442\u0432\u043e", "Europe/London" },
+ { "bg", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u041e\u0431\u0435\u0434\u0438\u043d\u0435\u043d\u043e \u043a\u0440\u0430\u043b\u0441\u0442\u0432\u043e", "Europe/London" },
+
+ { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", GMT_BG+"-0300", "-3:00" },
+ { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", GMT_BG+"-0300", "-3:00" },
+
+ // JB#5150
+ { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"+0530", "+5:30" },
+ { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", GMT_BG+"+0530", "+5:30" },
+ { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", GMT_BG+"+0530", "+5:30" },
+ { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+0530", "+5:30" },
+ { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", GMT_BG+"+0530", "+05:30" },
+ { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", GMT_BG+"+0530", "+5:30" },
+ { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\u0418\u043D\u0434\u0438\u044F", "Asia/Calcutta" },
+ { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u0418\u043D\u0434\u0438\u044F", "Asia/Calcutta" },
+
+ // ==========
+
+ { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
+ { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
+ { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "America/Los_Angeles" },
+ { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
+ { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6a19\u6e96\u6642", "America/Los_Angeles" },
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "America/Los_Angeles" },
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593", "America/Los_Angeles" },
+ // icu ja.txt has exemplar city for this time zone
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD (\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9)", "America/Los_Angeles" },
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u30A2\u30E1\u30EA\u30AB\u592A\u5E73\u6D0B\u6642\u9593", "America/Los_Angeles" },
+ { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD (\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9)", "America/Los_Angeles" },
+
+ { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ // icu ja.txt does not have info for this time zone
+ { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3 (\u30D6\u30A8\u30CE\u30B9\u30A2\u30A4\u30EC\u30B9)", "America/Buenos_Aires" },
+ { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "America/Buenos_Aires" },
+
+ { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ // icu ja.txt does not have info for this time zone
+ { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3 (\u30D6\u30A8\u30CE\u30B9\u30A2\u30A4\u30EC\u30B9)", "America/Buenos_Aires" },
+ { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "America/Buenos_Aires" },
+
+ { "ja", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
+ { "ja", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
+ { "ja", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
+ { "ja", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
+ { "ja", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
+ { "ja", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
+ { "ja", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
+ { "ja", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
+ { "ja", "America/Havana", "2004-07-15T00:00:00Z", "v", "\u30ad\u30e5\u30fc\u30d0\u6642\u9593", "America/Havana" },
+ { "ja", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\u30ad\u30e5\u30fc\u30d0\u6642\u9593", "America/Havana" },
+
+ { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
+ { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
+ // icu ja.txt does not have info for this time zone
+ { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },
+ { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },
+
+ { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
+ { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
+ { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },
+ { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 (\u30b7\u30c9\u30cb\u30fc)", "Australia/Sydney" },
+
+ { "ja", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
+ { "ja", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
+ { "ja", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
+ { "ja", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
+ { "ja", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\u30B0\u30EA\u30CB\u30C3\u30B8\u6A19\u6E96\u6642", "+0:00" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "V", "GMT+01:00", "+1:00" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "v", "\u30a4\u30ae\u30ea\u30b9\u6642\u9593", "Europe/London" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\u30a4\u30ae\u30ea\u30b9\u6642\u9593", "Europe/London" },
+ { "ja", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\u30a4\u30ae\u30ea\u30b9\u6642\u9593", "Europe/London" },
+
+ { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
+ { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
+
+ // JB#5150
+ { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
+ { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
+ { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
+ { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
+ { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\u30A4\u30F3\u30C9\u6642\u9593", "Asia/Calcutta" },
+ { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\u30A4\u30F3\u30C9\u6642\u9593", "Asia/Calcutta" },
+
+ // ==========
+
+ { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
+ { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
+ { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },
+ { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },
+ { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
+ { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
+ { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },
+ { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },
+ { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "US (Los Angeles)", "America/Los_Angeles" },
+ { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "US (Los Angeles)", "America/Los_Angeles" },
+
+ { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },
+ { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },
+
+ { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },
+ { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },
+
+ { "si", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
+ { "si", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
+ { "si", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
+ { "si", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
+ { "si", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
+ { "si", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
+ { "si", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
+ { "si", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
+ { "si", "America/Havana", "2004-07-15T00:00:00Z", "v", "CU", "America/Havana" },
+ { "si", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "CU", "America/Havana" },
+
+ { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
+ { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
+ { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },
+ { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },
+
+ { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
+ { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
+ { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
+ { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
+ { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
+ { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
+ { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
+ { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
+ { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },
+ { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },
+
+ { "si", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
+ { "si", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
+ { "si", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
+ { "si", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },
+ { "si", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
+ { "si", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
+ { "si", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
+ { "si", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
+ { "si", "Europe/London", "2004-07-15T00:00:00Z", "v", "GB", "Europe/London" },
+ { "si", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "GB", "Europe/London" },
+
+ { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
+ { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
+
+ // JB#5150
+ { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
+ { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
+ { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
+ { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
+ { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
+ { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
+ { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IN", "Asia/Calcutta" },
+ { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "IN", "Asia/Calcutta" },
+
+ };
+
+ /**
+ * Verify that strings which contain incomplete specifications are parsed
+ * correctly. In some instances, this means not being parsed at all, and
+ * returning an appropriate error.
+ */
+ public void TestPartialParse994() {
+
+ SimpleDateFormat f = new SimpleDateFormat();
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(1997, 1 - 1, 17, 10, 11, 42);
+ Date date = null;
+ tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:11:42", cal.getTime());
+ tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:", date);
+ tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10", date);
+ tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 ", date);
+ tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17", date);
+ }
+
+ // internal test subroutine, used by TestPartialParse994
+ public void tryPat994(SimpleDateFormat format, String pat, String str, Date expected) {
+ Date Null = null;
+ logln("Pattern \"" + pat + "\" String \"" + str + "\"");
+ try {
+ format.applyPattern(pat);
+ Date date = format.parse(str);
+ String f = ((DateFormat) format).format(date);
+ logln(" parse(" + str + ") -> " + date);
+ logln(" format -> " + f);
+ if (expected.equals(Null) || !date.equals(expected))
+ errln("FAIL: Expected null"); //" + expected);
+ if (!f.equals(str))
+ errln("FAIL: Expected " + str);
+ } catch (ParseException e) {
+ logln("ParseException: " + e.getMessage());
+ if (!(expected ==Null))
+ errln("FAIL: Expected " + expected);
+ } catch (Exception e) {
+ errln("*** Exception:");
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Verify the behavior of patterns in which digits for different fields run together
+ * without intervening separators.
+ */
+ public void TestRunTogetherPattern985() {
+ String format = "yyyyMMddHHmmssSSS";
+ String now, then;
+ //UBool flag;
+ SimpleDateFormat formatter = new SimpleDateFormat(format);
+ Date date1 = new Date();
+ now = ((DateFormat) formatter).format(date1);
+ logln(now);
+ ParsePosition pos = new ParsePosition(0);
+ Date date2 = formatter.parse(now, pos);
+ if (date2 == null)
+ then = "Parse stopped at " + pos.getIndex();
+ else
+ then = ((DateFormat) formatter).format(date2);
+ logln(then);
+ if (date2 == null || !date2.equals(date1))
+ errln("FAIL");
+ }
+
+ /**
+ * Verify the behavior of patterns in which digits for different fields run together
+ * without intervening separators.
+ */
+ public void TestRunTogetherPattern917() {
+ SimpleDateFormat fmt;
+ String myDate;
+ fmt = new SimpleDateFormat("yyyy/MM/dd");
+ myDate = "1997/02/03";
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(1997, 2 - 1, 3);
+ _testIt917(fmt, myDate, cal.getTime());
+ fmt = new SimpleDateFormat("yyyyMMdd");
+ myDate = "19970304";
+ cal.clear();
+ cal.set(1997, 3 - 1, 4);
+ _testIt917(fmt, myDate, cal.getTime());
+
+ }
+
+ // internal test subroutine, used by TestRunTogetherPattern917
+ public void _testIt917(SimpleDateFormat fmt, String str, Date expected) {
+ logln("pattern=" + fmt.toPattern() + " string=" + str);
+ Date o = new Date();
+ o = (Date) ((DateFormat) fmt).parseObject(str, new ParsePosition(0));
+ logln("Parsed object: " + o);
+ if (o == null || !o.equals(expected))
+ errln("FAIL: Expected " + expected);
+ String formatted = o==null? "null" : ((DateFormat) fmt).format(o);
+ logln( "Formatted string: " + formatted);
+ if (!formatted.equals(str))
+ errln( "FAIL: Expected " + str);
+ }
+
+ /**
+ * Verify the handling of Czech June and July, which have the unique attribute that
+ * one is a proper prefix substring of the other.
+ */
+ public void TestCzechMonths459() {
+ DateFormat fmt = DateFormat.getDateInstance(DateFormat.FULL, new Locale("cs", "", ""));
+ logln("Pattern " + ((SimpleDateFormat) fmt).toPattern());
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(1997, Calendar.JUNE, 15);
+ Date june = cal.getTime();
+ cal.clear();
+ cal.set(1997, Calendar.JULY, 15);
+ Date july = cal.getTime();
+ String juneStr = fmt.format(june);
+ String julyStr = fmt.format(july);
+ try {
+ logln("format(June 15 1997) = " + juneStr);
+ Date d = fmt.parse(juneStr);
+ String s = fmt.format(d);
+ int month, yr, day;
+ cal.setTime(d);
+ yr = cal.get(Calendar.YEAR);
+ month = cal.get(Calendar.MONTH);
+ day = cal.get(Calendar.DAY_OF_MONTH);
+ logln(" . parse . " + s + " (month = " + month + ")");
+ if (month != Calendar.JUNE)
+ errln("FAIL: Month should be June");
+ if (yr != 1997)
+ errln("FAIL: Year should be 1997");
+ if (day != 15)
+ errln("FAIL: day should be 15");
+ logln("format(July 15 1997) = " + julyStr);
+ d = fmt.parse(julyStr);
+ s = fmt.format(d);
+ cal.setTime(d);
+ yr = cal.get(Calendar.YEAR) - 1900;
+ month = cal.get(Calendar.MONTH);
+ day = cal.get(Calendar.DAY_OF_WEEK);
+ logln(" . parse . " + s + " (month = " + month + ")");
+ if (month != Calendar.JULY)
+ errln("FAIL: Month should be July");
+ } catch (ParseException e) {
+ errln(e.getMessage());
+ }
+ }
+
+ /**
+ * Test the handling of 'D' in patterns.
+ */
+ public void TestLetterDPattern212() {
+ String dateString = "1995-040.05:01:29";
+ String bigD = "yyyy-DDD.hh:mm:ss";
+ String littleD = "yyyy-ddd.hh:mm:ss";
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(1995, 0, 1, 5, 1, 29);
+ Date expLittleD = cal.getTime();
+ Date expBigD = new Date((long) (expLittleD.getTime() + 39 * 24 * 3600000.0));
+ expLittleD = expBigD; // Expect the same, with default lenient parsing
+ logln("dateString= " + dateString);
+ SimpleDateFormat formatter = new SimpleDateFormat(bigD);
+ ParsePosition pos = new ParsePosition(0);
+ Date myDate = formatter.parse(dateString, pos);
+ logln("Using " + bigD + " . " + myDate);
+ if (!myDate.equals(expBigD))
+ errln("FAIL: Expected " + expBigD);
+ formatter = new SimpleDateFormat(littleD);
+ pos = new ParsePosition(0);
+ myDate = formatter.parse(dateString, pos);
+ logln("Using " + littleD + " . " + myDate);
+ if (!myDate.equals(expLittleD))
+ errln("FAIL: Expected " + expLittleD);
+ }
+
+ /**
+ * Test the day of year pattern.
+ */
+ public void TestDayOfYearPattern195() {
+ Calendar cal = Calendar.getInstance();
+ Date today = cal.getTime();
+ int year,month,day;
+ year = cal.get(Calendar.YEAR);
+ month = cal.get(Calendar.MONTH);
+ day = cal.get(Calendar.DAY_OF_MONTH);
+ cal.clear();
+ cal.set(year, month, day);
+ Date expected = cal.getTime();
+ logln("Test Date: " + today);
+ SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getDateInstance();
+ tryPattern(sdf, today, null, expected);
+ tryPattern(sdf, today, "G yyyy DDD", expected);
+ }
+
+ // interl test subroutine, used by TestDayOfYearPattern195
+ public void tryPattern(SimpleDateFormat sdf, Date d, String pattern, Date expected) {
+ if (pattern != null)
+ sdf.applyPattern(pattern);
+ logln("pattern: " + sdf.toPattern());
+ String formatResult = ((DateFormat) sdf).format(d);
+ logln(" format -> " + formatResult);
+ try {
+ Date d2 = sdf.parse(formatResult);
+ logln(" parse(" + formatResult + ") -> " + d2);
+ if (!d2.equals(expected))
+ errln("FAIL: Expected " + expected);
+ String format2 = ((DateFormat) sdf).format(d2);
+ logln(" format -> " + format2);
+ if (!formatResult.equals(format2))
+ errln("FAIL: Round trip drift");
+ } catch (Exception e) {
+ errln(e.getMessage());
+ }
+ }
+
+ /**
+ * Test the handling of single quotes in patterns.
+ */
+ public void TestQuotePattern161() {
+ SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy 'at' hh:mm:ss a zzz", Locale.US);
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(1997, Calendar.AUGUST, 13, 10, 42, 28);
+ Date currentTime_1 = cal.getTime();
+ String dateString = ((DateFormat) formatter).format(currentTime_1);
+ String exp = "08/13/1997 at 10:42:28 AM ";
+ logln("format(" + currentTime_1 + ") = " + dateString);
+ if (!dateString.substring(0, exp.length()).equals(exp))
+ errln("FAIL: Expected " + exp);
+
+ }
+
+ /**
+ * Verify the correct behavior when handling invalid input strings.
+ */
+ public void TestBadInput135() {
+ int looks[] = {DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, DateFormat.FULL};
+ int looks_length = looks.length;
+ final String[] strings = {"Mar 15", "Mar 15 1997", "asdf", "3/1/97 1:23:", "3/1/00 1:23:45 AM"};
+ int strings_length = strings.length;
+ DateFormat full = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.US);
+ String expected = "March 1, 2000 1:23:45 AM ";
+ for (int i = 0; i < strings_length; ++i) {
+ final String text = strings[i];
+ for (int j = 0; j < looks_length; ++j) {
+ int dateLook = looks[j];
+ for (int k = 0; k < looks_length; ++k) {
+ int timeLook = looks[k];
+ DateFormat df = DateFormat.getDateTimeInstance(dateLook, timeLook, Locale.US);
+ String prefix = text + ", " + dateLook + "/" + timeLook + ": ";
+ try {
+ Date when = df.parse(text);
+ if (when == null) {
+ errln(prefix + "SHOULD NOT HAPPEN: parse returned null.");
+ continue;
+ }
+ if (when != null) {
+ String format;
+ format = full.format(when);
+ logln(prefix + "OK: " + format);
+ if (!format.substring(0, expected.length()).equals(expected))
+ errln("FAIL: Expected " + expected);
+ }
+ } catch(java.text.ParseException e) {
+ logln(e.getMessage());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Verify the correct behavior when parsing an array of inputs against an
+ * array of patterns, with known results. The results are encoded after
+ * the input strings in each row.
+ */
+ public void TestBadInput135a() {
+
+ SimpleDateFormat dateParse = new SimpleDateFormat("", Locale.US);
+ final String ss;
+ Date date;
+ String[] parseFormats ={"MMMM d, yyyy", "MMMM d yyyy", "M/d/yy",
+ "d MMMM, yyyy", "d MMMM yyyy", "d MMMM",
+ "MMMM d", "yyyy", "h:mm a MMMM d, yyyy" };
+ String[] inputStrings = {
+ "bogus string", null, null, null, null, null, null, null, null, null,
+ "April 1, 1997", "April 1, 1997", null, null, null, null, null, "April 1", null, null,
+ "Jan 1, 1970", "January 1, 1970", null, null, null, null, null, "January 1", null, null,
+ "Jan 1 2037", null, "January 1 2037", null, null, null, null, "January 1", null, null,
+ "1/1/70", null, null, "1/1/70", null, null, null, null, "0001", null,
+ "5 May 1997", null, null, null, null, "5 May 1997", "5 May", null, "0005", null,
+ "16 May", null, null, null, null, null, "16 May", null, "0016", null,
+ "April 30", null, null, null, null, null, null, "April 30", null, null,
+ "1998", null, null, null, null, null, null, null, "1998", null,
+ "1", null, null, null, null, null, null, null, "0001", null,
+ "3:00 pm Jan 1, 1997", null, null, null, null, null, null, null, "0003", "3:00 PM January 1, 1997",
+ };
+ final int PF_LENGTH = parseFormats.length;
+ final int INPUT_LENGTH = inputStrings.length;
+
+ dateParse.applyPattern("d MMMM, yyyy");
+ dateParse.setTimeZone(TimeZone.getDefault());
+ ss = "not parseable";
+ // String thePat;
+ logln("Trying to parse \"" + ss + "\" with " + dateParse.toPattern());
+ try {
+ date = dateParse.parse(ss);
+ } catch (Exception ex) {
+ logln("FAIL:" + ex);
+ }
+ for (int i = 0; i < INPUT_LENGTH; i += (PF_LENGTH + 1)) {
+ ParsePosition parsePosition = new ParsePosition(0);
+ String s = inputStrings[i];
+ for (int index = 0; index < PF_LENGTH; ++index) {
+ final String expected = inputStrings[i + 1 + index];
+ dateParse.applyPattern(parseFormats[index]);
+ dateParse.setTimeZone(TimeZone.getDefault());
+ try {
+ parsePosition.setIndex(0);
+ date = dateParse.parse(s, parsePosition);
+ if (parsePosition.getIndex() != 0) {
+ String s1, s2;
+ s1 = s.substring(0, parsePosition.getIndex());
+ s2 = s.substring(parsePosition.getIndex(), s.length());
+ if (date == null) {
+ errln("ERROR: null result fmt=\"" + parseFormats[index]
+ + "\" pos=" + parsePosition.getIndex()
+ + " " + s1 + "|" + s2);
+ } else {
+ String result = ((DateFormat) dateParse).format(date);
+ logln("Parsed \"" + s + "\" using \"" + dateParse.toPattern() + "\" to: " + result);
+ if (expected == null)
+ errln("FAIL: Expected parse failure");
+ else
+ if (!result.equals(expected))
+ errln("FAIL: Expected " + expected);
+ }
+ } else
+ if (expected != null) {
+ errln("FAIL: Expected " + expected + " from \"" + s
+ + "\" with \"" + dateParse.toPattern()+ "\"");
+ }
+ } catch (Exception ex) {
+ logln("FAIL:" + ex);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Test the parsing of two-digit years.
+ */
+ public void TestTwoDigitYear() {
+ DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.set(117 + 1900, Calendar.JUNE, 5);
+ parse2DigitYear(fmt, "6/5/17", cal.getTime());
+ cal.clear();
+ cal.set(34 + 1900, Calendar.JUNE, 4);
+ parse2DigitYear(fmt, "6/4/34", cal.getTime());
+ }
+
+ // internal test subroutine, used by TestTwoDigitYear
+ public void parse2DigitYear(DateFormat fmt, String str, Date expected) {
+ try {
+ Date d = fmt.parse(str);
+ logln("Parsing \""+ str+ "\" with "+ ((SimpleDateFormat) fmt).toPattern()
+ + " => "+ d);
+ if (!d.equals(expected))
+ errln( "FAIL: Expected " + expected);
+ } catch (ParseException e) {
+ errln(e.getMessage());
+ }
+ }
+
+ /**
+ * Test the formatting of time zones.
+ */
+ public void TestDateFormatZone061() {
+ Date date;
+ DateFormat formatter;
+ date = new Date(859248000000l);
+ logln("Date 1997/3/25 00:00 GMT: " + date);
+ formatter = new SimpleDateFormat("dd-MMM-yyyyy HH:mm", Locale.UK);
+ formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
+ String temp = formatter.format(date);
+ logln("Formatted in GMT to: " + temp);
+ try {
+ Date tempDate = formatter.parse(temp);
+ logln("Parsed to: " + tempDate);
+ if (!tempDate.equals(date))
+ errln("FAIL: Expected " + date + " Got: " + tempDate);
+ } catch (Throwable t) {
+ System.out.println(t);
+ }
+
+ }
+
+ /**
+ * Test the formatting of time zones.
+ */
+ public void TestDateFormatZone146() {
+ TimeZone saveDefault = TimeZone.getDefault();
+
+ //try {
+ TimeZone thedefault = TimeZone.getTimeZone("GMT");
+ TimeZone.setDefault(thedefault);
+ // java.util.Locale.setDefault(new java.util.Locale("ar", "", ""));
+
+ // check to be sure... its GMT all right
+ TimeZone testdefault = TimeZone.getDefault();
+ String testtimezone = testdefault.getID();
+ if (testtimezone.equals("GMT"))
+ logln("Test timezone = " + testtimezone);
+ else
+ errln("Test timezone should be GMT, not " + testtimezone);
+
+ // now try to use the default GMT time zone
+ GregorianCalendar greenwichcalendar = new GregorianCalendar(1997, 3, 4, 23, 0);
+ //*****************************greenwichcalendar.setTimeZone(TimeZone.getDefault());
+ //greenwichcalendar.set(1997, 3, 4, 23, 0);
+ // try anything to set hour to 23:00 !!!
+ greenwichcalendar.set(Calendar.HOUR_OF_DAY, 23);
+ // get time
+ Date greenwichdate = greenwichcalendar.getTime();
+ // format every way
+ String DATA[] = {
+ "simple format: ", "04/04/97 23:00 GMT+00:00",
+ "MM/dd/yy HH:mm zzz", "full format: ",
+ "Friday, April 4, 1997 11:00:00 o'clock PM GMT+00:00",
+ "EEEE, MMMM d, yyyy h:mm:ss 'o''clock' a zzz",
+ "long format: ", "April 4, 1997 11:00:00 PM GMT+00:00",
+ "MMMM d, yyyy h:mm:ss a z", "default format: ",
+ "04-Apr-97 11:00:00 PM", "dd-MMM-yy h:mm:ss a",
+ "short format: ", "4/4/97 11:00 PM",
+ "M/d/yy h:mm a"};
+ int DATA_length = DATA.length;
+
+ for (int i = 0; i < DATA_length; i += 3) {
+ DateFormat fmt = new SimpleDateFormat(DATA[i + 2], Locale.ENGLISH);
+ fmt.setCalendar(greenwichcalendar);
+ String result = fmt.format(greenwichdate);
+ logln(DATA[i] + result);
+ if (!result.equals(DATA[i + 1]))
+ errln("FAIL: Expected " + DATA[i + 1] + ", got " + result);
+ }
+ //}
+ //finally {
+ TimeZone.setDefault(saveDefault);
+ //}
+
+ }
+
+ /**
+ * Test the formatting of dates in different locales.
+ */
+ public void TestLocaleDateFormat() {
+
+ Date testDate = new Date(874306800000l); //Mon Sep 15 00:00:00 PDT 1997
+ DateFormat dfFrench = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.FRENCH);
+ DateFormat dfUS = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US);
+ //Set TimeZone = PDT
+ TimeZone tz = TimeZone.getTimeZone("PST");
+ dfFrench.setTimeZone(tz);
+ dfUS.setTimeZone(tz);
+ String expectedFRENCH_JDK12 = "lundi 15 septembre 1997 00:00:00 heure avanc\u00E9e du Pacifique";
+ //String expectedFRENCH = "lundi 15 septembre 1997 00 h 00 PDT";
+ String expectedUS = "Monday, September 15, 1997 12:00:00 AM Pacific Daylight Time";
+ logln("Date set to : " + testDate);
+ String out = dfFrench.format(testDate);
+ logln("Date Formated with French Locale " + out);
+ //fix the jdk resources differences between jdk 1.2 and jdk 1.3
+ /* our own data only has GMT-xxxx information here
+ String javaVersion = System.getProperty("java.version");
+ if (javaVersion.startsWith("1.2")) {
+ if (!out.equals(expectedFRENCH_JDK12))
+ errln("FAIL: Expected " + expectedFRENCH_JDK12+" Got "+out);
+ } else {
+ if (!out.equals(expectedFRENCH))
+ errln("FAIL: Expected " + expectedFRENCH);
+ }
+ */
+ if (!out.equals(expectedFRENCH_JDK12))
+ errln("FAIL: Expected " + expectedFRENCH_JDK12+" Got "+out);
+ out = dfUS.format(testDate);
+ logln("Date Formated with US Locale " + out);
+ if (!out.equals(expectedUS))
+ errln("FAIL: Expected " + expectedUS+" Got "+out);
+ }
+
+ /**
+ * Test the formatting of dates with the 'NONE' keyword.
+ */
+ public void TestDateFormatNone() {
+
+ Date testDate = new Date(874306800000l); //Mon Sep 15 00:00:00 PDT 1997
+ DateFormat dfFrench = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.NONE, Locale.FRENCH);
+ //Set TimeZone = PDT
+ TimeZone tz = TimeZone.getTimeZone("PST");
+ dfFrench.setTimeZone(tz);
+ String expectedFRENCH_JDK12 = "lundi 15 septembre 1997";
+ //String expectedFRENCH = "lundi 15 septembre 1997 00 h 00 PDT";
+ logln("Date set to : " + testDate);
+ String out = dfFrench.format(testDate);
+ logln("Date Formated with French Locale " + out);
+ if (!out.equals(expectedFRENCH_JDK12))
+ errln("FAIL: Expected " + expectedFRENCH_JDK12+" Got "+out);
+ }
+
+
+ /**
+ * Test DateFormat(Calendar) API
+ */
+ public void TestDateFormatCalendar() {
+ DateFormat date=null, time=null, full=null;
+ Calendar cal=null;
+ ParsePosition pos = new ParsePosition(0);
+ String str;
+ Date when;
+
+ /* Create a formatter for date fields. */
+ date = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
+ if (date == null) {
+ errln("FAIL: getDateInstance failed");
+ return;
+ }
+
+ /* Create a formatter for time fields. */
+ time = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.US);
+ if (time == null) {
+ errln("FAIL: getTimeInstance failed");
+ return;
+ }
+
+ /* Create a full format for output */
+ full = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL,
+ Locale.US);
+ if (full == null) {
+ errln("FAIL: getInstance failed");
+ return;
+ }
+
+ /* Create a calendar */
+ cal = Calendar.getInstance(Locale.US);
+ if (cal == null) {
+ errln("FAIL: Calendar.getInstance failed");
+ return;
+ }
+
+ /* Parse the date */
+ cal.clear();
+ str = "4/5/2001";
+ pos.setIndex(0);
+ date.parse(str, cal, pos);
+ if (pos.getIndex() != str.length()) {
+ errln("FAIL: DateFormat.parse(4/5/2001) failed at " +
+ pos.getIndex());
+ return;
+ }
+
+ /* Parse the time */
+ str = "5:45 PM";
+ pos.setIndex(0);
+ time.parse(str, cal, pos);
+ if (pos.getIndex() != str.length()) {
+ errln("FAIL: DateFormat.parse(17:45) failed at " +
+ pos.getIndex());
+ return;
+ }
+
+ /* Check result */
+ when = cal.getTime();
+ str = full.format(when);
+ // Thursday, April 5, 2001 5:45:00 PM PDT 986517900000
+ if (when.getTime() == 986517900000.0) {
+ logln("Ok: Parsed result: " + str);
+ } else {
+ errln("FAIL: Parsed result: " + str + ", exp 4/5/2001 5:45 PM");
+ }
+ }
+
+ /**
+ * Test DateFormat's parsing of space characters. See jitterbug 1916.
+ */
+ public void TestSpaceParsing() {
+
+ String DATA[] = {
+ "yyyy MM dd",
+
+ // pattern, input, expected output (in quotes)
+ "MMMM d yy", " 04 05 06", null, // MMMM wants Apr/April
+ null, "04 05 06", null,
+ "MM d yy", " 04 05 06", "2006 04 05",
+ null, "04 05 06", "2006 04 05",
+ "MMMM d yy", " Apr 05 06", "2006 04 05",
+ null, "Apr 05 06", "2006 04 05",
+ };
+
+ expectParse(DATA, new Locale("en", "", ""));
+ }
+
+ /**
+ * Test handling of "HHmmss" pattern.
+ */
+ public void TestExactCountFormat() {
+ String DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+
+ // pattern, input, expected parse or null if expect parse failure
+ "HHmmss", "123456", "1970 01 01 12:34:56",
+ null, "12345", "1970 01 01 01:23:45",
+ null, "1234", null,
+ null, "00-05", null,
+ null, "12-34", null,
+ null, "00+05", null,
+ "ahhmm", "PM730", "1970 01 01 19:30:00",
+ };
+
+ expectParse(DATA, new Locale("en", "", ""));
+ }
+
+ /**
+ * Test handling of white space.
+ */
+ public void TestWhiteSpaceParsing() {
+ String DATA[] = {
+ "yyyy MM dd",
+
+ // pattern, input, expected parse or null if expect parse failure
+
+ // Pattern space run should parse input text space run
+ "MM d yy", " 04 01 03", "2003 04 01",
+ null, " 04 01 03 ", "2003 04 01",
+ };
+
+ expectParse(DATA, new Locale("en", "", ""));
+ }
+
+ public void TestInvalidPattern() {
+ Exception e = null;
+ SimpleDateFormat f = null;
+ String out = null;
+ try {
+ f = new SimpleDateFormat("Yesterday");
+ out = f.format(new Date(0));
+ } catch (IllegalArgumentException e1) {
+ e = e1;
+ }
+ if (e != null) {
+ logln("Ok: Received " + e.getMessage());
+ } else {
+ errln("FAIL: Expected exception, got " + f.toPattern() +
+ "; " + out);
+ }
+ }
+
+ public void TestGreekMay() {
+ Date date = new Date(-9896080848000L);
+ SimpleDateFormat fmt = new SimpleDateFormat("EEEE, dd MMMM yyyy h:mm:ss a",
+ new Locale("el", "", ""));
+ String str = fmt.format(date);
+ ParsePosition pos = new ParsePosition(0);
+ Date d2 = fmt.parse(str, pos);
+ if (!date.equals(d2)) {
+ errln("FAIL: unable to parse strings where case-folding changes length");
+ }
+ }
+
+ public void testErrorChecking() {
+ try {
+ DateFormat.getDateTimeInstance(-1, -1, Locale.US);
+ errln("Expected exception for getDateTimeInstance(-1, -1, Locale)");
+ }
+ catch(IllegalArgumentException e) {
+ logln("one ok");
+ }
+ catch(Exception e) {
+ warnln("Expected IllegalArgumentException, got: " + e);
+ }
+
+ try {
+ DateFormat df = new SimpleDateFormat("aabbccc");
+ df.format(new Date());
+ errln("Expected exception for format with bad pattern");
+ }
+ catch(IllegalArgumentException ex) {
+ logln("two ok");
+ }
+ catch(Exception e) {
+ warnln("Expected IllegalArgumentException, got: " + e);
+ }
+
+ {
+ SimpleDateFormat fmt = new SimpleDateFormat("dd/MM/yy"); // opposite of text
+ fmt.set2DigitYearStart(getDate(2003, Calendar.DECEMBER, 25));
+ String text = "12/25/03";
+ Calendar xcal = new GregorianCalendar();
+ xcal.setLenient(false);
+ ParsePosition pp = new ParsePosition(0);
+ fmt.parse(text, xcal, pp); // should get parse error on second field, not lenient
+ if (pp.getErrorIndex() == -1) {
+ errln("Expected parse error");
+ } else {
+ logln("three ok");
+ }
+ }
+ }
+
+ public void TestChineseDateFormatLocalizedPatternChars() {
+ // jb 4904
+ // make sure we can display localized versions of the chars used in the default
+ // chinese date format patterns
+ Calendar chineseCalendar = new ChineseCalendar();
+ chineseCalendar.setTimeInMillis((new Date()).getTime());
+ SimpleDateFormat longChineseDateFormat =
+ (SimpleDateFormat)chineseCalendar.getDateTimeFormat(DateFormat.LONG, DateFormat.LONG, Locale.CHINA );
+ DateFormatSymbols dfs = new ChineseDateFormatSymbols( chineseCalendar, Locale.CHINA );
+ longChineseDateFormat.setDateFormatSymbols( dfs );
+ // This next line throws the exception
+ try {
+ longChineseDateFormat.toLocalizedPattern();
+ }
+ catch (Exception e) {
+ errln("could not localized pattern: " + e.getMessage());
+ }
+ }
+
+ public void TestCoverage() {
+ Date now = new Date();
+ Calendar cal = new GregorianCalendar();
+ DateFormat f = DateFormat.getTimeInstance();
+ logln("time: " + f.format(now));
+
+ int hash = f.hashCode(); // sigh, everyone overrides this
+
+ f = DateFormat.getInstance(cal);
+ if(hash == f.hashCode()){
+ errln("FAIL: hashCode equal for inequal objects");
+ }
+ logln("time again: " + f.format(now));
+
+ f = DateFormat.getTimeInstance(cal, DateFormat.FULL);
+ logln("time yet again: " + f.format(now));
+
+ f = DateFormat.getDateInstance();
+ logln("time yet again: " + f.format(now));
+
+ ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME,"de_DE");
+ DateFormatSymbols sym = new DateFormatSymbols(rb, Locale.GERMANY);
+ DateFormatSymbols sym2 = (DateFormatSymbols)sym.clone();
+ if (sym.hashCode() != sym2.hashCode()) {
+ errln("fail, date format symbols hashcode not equal");
+ }
+ if (!sym.equals(sym2)) {
+ errln("fail, date format symbols not equal");
+ }
+
+ Locale foo = new Locale("fu", "FU", "BAR");
+ rb = null;
+ sym = new DateFormatSymbols(GregorianCalendar.class, foo);
+ sym.equals(null);
+
+ sym = new ChineseDateFormatSymbols();
+ sym = new ChineseDateFormatSymbols(new ChineseCalendar(), foo);
+ // cover new ChineseDateFormatSymbols(Calendar, ULocale)
+ ChineseCalendar ccal = new ChineseCalendar();
+ sym = new ChineseDateFormatSymbols(ccal, ULocale.CHINA); //gclsh1 add
+
+ StringBuffer buf = new StringBuffer();
+ FieldPosition pos = new FieldPosition(0);
+
+ f.format((Object)cal, buf, pos);
+ f.format((Object)now, buf, pos);
+ f.format((Object)new Long(now.getTime()), buf, pos);
+ try {
+ f.format((Object)"Howdy", buf, pos);
+ }
+ catch (Exception e) {
+ }
+
+ NumberFormat nf = f.getNumberFormat();
+ f.setNumberFormat(nf);
+
+ boolean lenient = f.isLenient();
+ f.setLenient(lenient);
+
+ ULocale uloc = f.getLocale(ULocale.ACTUAL_LOCALE);
+
+ DateFormat sdfmt = new SimpleDateFormat();
+
+ if (f.hashCode() != f.hashCode()) {
+ errln("hashCode is not stable");
+ }
+ if (!f.equals(f)) {
+ errln("f != f");
+ }
+ if (f.equals(null)) {
+ errln("f should not equal null");
+ }
+ if (f.equals(sdfmt)) {
+ errln("A time instance shouldn't equal a default date format");
+ }
+
+ Date d;
+ {
+ ChineseDateFormat fmt = new ChineseDateFormat("yymm", Locale.US);
+ try {
+ fmt.parse("2"); // fewer symbols than required 2
+ errln("whoops");
+ }
+ catch (ParseException e) {
+ logln("ok");
+ }
+
+ try {
+ fmt.parse("2255"); // should succeed with obeycount
+ logln("ok");
+ }
+ catch (ParseException e) {
+ errln("whoops");
+ }
+
+ try {
+ fmt.parse("ni hao"); // not a number, should fail
+ errln("whoops ni hao");
+ }
+ catch (ParseException e) {
+ logln("ok ni hao");
+ }
+ }
+ {
+ Calendar xcal = new GregorianCalendar();
+ xcal.set(Calendar.HOUR_OF_DAY, 0);
+ DateFormat fmt = new SimpleDateFormat("k");
+ StringBuffer xbuf = new StringBuffer();
+ FieldPosition fpos = new FieldPosition(Calendar.HOUR_OF_DAY);
+ fmt.format(xcal, xbuf, fpos);
+ try {
+ fmt.parse(xbuf.toString());
+ logln("ok");
+
+ xbuf.setLength(0);
+ xcal.set(Calendar.HOUR_OF_DAY, 25);
+ fmt.format(xcal, xbuf, fpos);
+ Date d2 = fmt.parse(xbuf.toString());
+ logln("ok again - d2=" + d2);
+ }
+ catch (ParseException e) {
+ errln("whoops");
+ }
+ }
+
+ {
+ // cover gmt+hh:mm
+ DateFormat fmt = new SimpleDateFormat("MM/dd/yy z");
+ try {
+ d = fmt.parse("07/10/53 GMT+10:00");
+ logln("ok : d = " + d);
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 GMT+10:00 for pattern MM/dd/yy z");
+ }
+
+ // cover invalid separator after GMT
+ {
+ ParsePosition pp = new ParsePosition(0);
+ String text = "07/10/53 GMT=10:00";
+ d = fmt.parse(text, pp);
+ if(pp.getIndex()!=12){
+ errln("Parse of 07/10/53 GMT=10:00 for pattern MM/dd/yy z");
+ }
+ logln("Parsing of the text stopped at pos: " + pp.getIndex() + " as expected and length is "+text.length());
+ }
+
+ // cover bad text after GMT+.
+ try {
+ fmt.parse("07/10/53 GMT+blecch");
+ logln("ok GMT+blecch");
+ }
+ catch (ParseException e) {
+ errln("whoops GMT+blecch");
+ }
+
+ // cover bad text after GMT+hh:.
+ try {
+ fmt.parse("07/10/53 GMT+07:blecch");
+ logln("ok GMT+xx:blecch");
+ }
+ catch (ParseException e) {
+ errln("whoops GMT+xx:blecch");
+ }
+
+ // cover no ':' GMT+#, # < 24 (hh)
+ try {
+ d = fmt.parse("07/10/53 GMT+07");
+ logln("ok GMT+07");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 GMT+07 for pattern MM/dd/yy z");
+ }
+
+ // cover no ':' GMT+#, # > 24 (hhmm)
+ try {
+ d = fmt.parse("07/10/53 GMT+0730");
+ logln("ok");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 GMT+0730 for pattern MM/dd/yy z");
+ }
+
+ // cover GMT+#, # with second field
+ try {
+ d = fmt.parse("07/10/53 GMT+07:30:15");
+ logln("ok GMT+07:30:15");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 GMT+07:30:15 for pattern MM/dd/yy z");
+ }
+
+ // cover no ':' GMT+#, # with second field, no leading zero
+ try {
+ d = fmt.parse("07/10/53 GMT+73015");
+ logln("ok GMT+73015");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 GMT+73015 for pattern MM/dd/yy z");
+ }
+
+ // cover no ':' GMT+#, # with 1 digit second field
+ try {
+ d = fmt.parse("07/10/53 GMT+07300");
+ logln("ok GMT+07300");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 GMT+07300 for pattern MM/dd/yy z");
+ }
+
+ // cover raw digits with no leading sign (bad RFC822)
+ try {
+ d = fmt.parse("07/10/53 07");
+ errln("Parse of 07/10/53 07 for pattern MM/dd/yy z passed!");
+ }
+ catch (ParseException e) {
+ logln("ok");
+ }
+
+ // cover raw digits (RFC822)
+ try {
+ d = fmt.parse("07/10/53 +07");
+ logln("ok");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 +07 for pattern MM/dd/yy z failed");
+ }
+
+ // cover raw digits (RFC822)
+ try {
+ d = fmt.parse("07/10/53 -0730");
+ logln("ok");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 -00730 for pattern MM/dd/yy z failed");
+ }
+
+ // cover raw digits (RFC822) in DST
+ try {
+ fmt.setTimeZone(TimeZone.getTimeZone("PDT"));
+ d = fmt.parse("07/10/53 -0730");
+ logln("ok");
+ }
+ catch (ParseException e) {
+ errln("Parse of 07/10/53 -0730 for pattern MM/dd/yy z failed");
+ }
+ }
+
+ // TODO: revisit toLocalizedPattern
+ if (false) {
+ SimpleDateFormat fmt = new SimpleDateFormat("aabbcc");
+ try {
+ String pat = fmt.toLocalizedPattern();
+ errln("whoops, shouldn't have been able to localize aabbcc");
+ }
+ catch (IllegalArgumentException e) {
+ logln("aabbcc localize ok");
+ }
+ }
+
+ {
+ SimpleDateFormat fmt = new SimpleDateFormat("'aabbcc");
+ try {
+ fmt.toLocalizedPattern();
+ errln("whoops, localize unclosed quote");
+ }
+ catch (IllegalArgumentException e) {
+ logln("localize unclosed quote ok");
+ }
+ }
+ {
+ SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy z");
+ String text = "08/15/58 DBDY"; // bogus time zone
+ try {
+ fmt.parse(text);
+ errln("recognized bogus time zone DBDY");
+ }
+ catch (ParseException e) {
+ logln("time zone ex ok");
+ }
+ }
+
+ {
+ // force fallback to default timezone when fmt timezone
+ // is not named
+ SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy z");
+ // force fallback to default time zone, still fails
+ fmt.setTimeZone(TimeZone.getTimeZone("GMT+0147")); // not in equivalency group
+ String text = "08/15/58 DBDY";
+ try {
+ fmt.parse(text);
+ errln("Parse of 07/10/53 DBDY for pattern MM/dd/yy z passed");
+ }
+ catch (ParseException e) {
+ logln("time zone ex2 ok");
+ }
+
+ // force success on fallback
+ text = "08/15/58 " + TimeZone.getDefault().getID();
+ try {
+ fmt.parse(text);
+ logln("found default tz");
+ }
+ catch (ParseException e) {
+ errln("whoops, got parse exception");
+ }
+ }
+
+ {
+ // force fallback to symbols list of timezones when neither
+ // fmt and default timezone is named
+ SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy z");
+ TimeZone oldtz = TimeZone.getDefault();
+ TimeZone newtz = TimeZone.getTimeZone("GMT+0137"); // nonstandard tz
+ fmt.setTimeZone(newtz);
+ TimeZone.setDefault(newtz); // todo: fix security issue
+
+ // fallback to symbol list, but fail
+ String text = "08/15/58 DBDY"; // try to parse the bogus time zone
+ try {
+ fmt.parse(text);
+ errln("Parse of 07/10/53 DBDY for pattern MM/dd/yy z passed");
+ }
+ catch (ParseException e) {
+ logln("time zone ex3 ok");
+ }
+ catch (Exception e) {
+ // hmmm... this shouldn't happen. don't want to exit this
+ // fn with timezone improperly set, so just in case
+ TimeZone.setDefault(oldtz);
+ throw new IllegalStateException(e.getMessage());
+ }
+
+ // create DFS that recognizes our bogus time zone, sortof
+ DateFormatSymbols xsym = new DateFormatSymbols();
+ String[][] tzids = xsym.getZoneStrings();
+ if (tzids.length > 0) { // let's hope!
+ tzids[0][1] = "DBDY"; // change a local name
+ logln("replaced '" + tzids[0][0] + "' with DBDY");
+
+ xsym.setZoneStrings(tzids);
+ fmt.setDateFormatSymbols(xsym);
+
+ try {
+ fmt.parse(text);
+ logln("we parsed DBDY (as GMT, but still...)");
+ }
+ catch (ParseException e) {
+ errln("hey, still didn't recognize DBDY");
+ }
+ finally {
+ TimeZone.setDefault(oldtz);
+ }
+ }
+ }
+
+ {
+ //cover getAvailableULocales
+ final ULocale[] locales = DateFormat.getAvailableULocales();
+ long count = locales.length;
+ if (count==0) {
+ errln(" got a empty list for getAvailableULocales");
+ }else{
+ logln("" + count + " available ulocales");
+ }
+ }
+
+ {
+ //cover DateFormatSymbols.getDateFormatBundle
+ cal = new GregorianCalendar();
+ Locale loc = Locale.getDefault();
+ DateFormatSymbols mysym = new DateFormatSymbols(cal, loc);
+ if (mysym == null)
+ errln("FAIL: constructs DateFormatSymbols with calendar and locale failed");
+
+ uloc = ULocale.getDefault();
+ // These APIs are obsolete and return null
+ ResourceBundle resb = DateFormatSymbols.getDateFormatBundle(cal, loc);
+ ResourceBundle resb2 = DateFormatSymbols.getDateFormatBundle(cal, uloc);
+ ResourceBundle resb3 = DateFormatSymbols.getDateFormatBundle(cal.getClass(), loc);
+ ResourceBundle resb4 = DateFormatSymbols.getDateFormatBundle(cal.getClass(), uloc);
+
+ if (resb != null) {
+ logln("resb is not null");
+ }
+ if (resb2 != null) {
+ logln("resb2 is not null");
+ }
+ if (resb3 != null) {
+ logln("resb3 is not null");
+ }
+ if (resb4 != null) {
+ logln("resb4 is not null");
+ }
+ }
+
+ {
+ //cover DateFormatSymbols.getInstance
+ DateFormatSymbols datsym1 = DateFormatSymbols.getInstance();
+ DateFormatSymbols datsym2 = new DateFormatSymbols();
+ if (!datsym1.equals(datsym2)) {
+ errln("FAIL: DateFormatSymbols returned by getInstance()" +
+ "does not match new DateFormatSymbols().");
+ }
+ datsym1 = DateFormatSymbols.getInstance(Locale.JAPAN);
+ datsym2 = DateFormatSymbols.getInstance(ULocale.JAPAN);
+ if (!datsym1.equals(datsym2)) {
+ errln("FAIL: DateFormatSymbols returned by getInstance(Locale.JAPAN)" +
+ "does not match the one returned by getInstance(ULocale.JAPAN).");
+ }
+ }
+ {
+ //cover DateFormatSymbols.getAvailableLocales/getAvailableULocales
+ Locale[] allLocales = DateFormatSymbols.getAvailableLocales();
+ if (allLocales.length == 0) {
+ errln("FAIL: Got a empty list for DateFormatSymbols.getAvailableLocales");
+ } else {
+ logln("PASS: " + allLocales.length +
+ " available locales returned by DateFormatSymbols.getAvailableLocales");
+ }
+
+ ULocale[] allULocales = DateFormatSymbols.getAvailableULocales();
+ if (allULocales.length == 0) {
+ errln("FAIL: Got a empty list for DateFormatSymbols.getAvailableLocales");
+ } else {
+ logln("PASS: " + allULocales.length +
+ " available locales returned by DateFormatSymbols.getAvailableULocales");
+ }
+ }
+ }
+
+ public void TestStandAloneMonths()
+ {
+ String EN_DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+
+ "yyyy LLLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 March 10 16:36:31", "2004 03 10 16:36:31",
+ "yyyy LLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31",
+ "yyyy LLLL dd H:mm:ss", "F", "2004 03 10 16:36:31", "2004 March 10 16:36:31",
+ "yyyy LLL dd H:mm:ss", "pf", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31",
+
+ "LLLL", "fp", "1970 01 01 0:00:00", "January", "1970 01 01 0:00:00",
+ "LLLL", "fp", "1970 02 01 0:00:00", "February", "1970 02 01 0:00:00",
+ "LLLL", "fp", "1970 03 01 0:00:00", "March", "1970 03 01 0:00:00",
+ "LLLL", "fp", "1970 04 01 0:00:00", "April", "1970 04 01 0:00:00",
+ "LLLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",
+ "LLLL", "fp", "1970 06 01 0:00:00", "June", "1970 06 01 0:00:00",
+ "LLLL", "fp", "1970 07 01 0:00:00", "July", "1970 07 01 0:00:00",
+ "LLLL", "fp", "1970 08 01 0:00:00", "August", "1970 08 01 0:00:00",
+ "LLLL", "fp", "1970 09 01 0:00:00", "September", "1970 09 01 0:00:00",
+ "LLLL", "fp", "1970 10 01 0:00:00", "October", "1970 10 01 0:00:00",
+ "LLLL", "fp", "1970 11 01 0:00:00", "November", "1970 11 01 0:00:00",
+ "LLLL", "fp", "1970 12 01 0:00:00", "December", "1970 12 01 0:00:00",
+
+ "LLL", "fp", "1970 01 01 0:00:00", "Jan", "1970 01 01 0:00:00",
+ "LLL", "fp", "1970 02 01 0:00:00", "Feb", "1970 02 01 0:00:00",
+ "LLL", "fp", "1970 03 01 0:00:00", "Mar", "1970 03 01 0:00:00",
+ "LLL", "fp", "1970 04 01 0:00:00", "Apr", "1970 04 01 0:00:00",
+ "LLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",
+ "LLL", "fp", "1970 06 01 0:00:00", "Jun", "1970 06 01 0:00:00",
+ "LLL", "fp", "1970 07 01 0:00:00", "Jul", "1970 07 01 0:00:00",
+ "LLL", "fp", "1970 08 01 0:00:00", "Aug", "1970 08 01 0:00:00",
+ "LLL", "fp", "1970 09 01 0:00:00", "Sep", "1970 09 01 0:00:00",
+ "LLL", "fp", "1970 10 01 0:00:00", "Oct", "1970 10 01 0:00:00",
+ "LLL", "fp", "1970 11 01 0:00:00", "Nov", "1970 11 01 0:00:00",
+ "LLL", "fp", "1970 12 01 0:00:00", "Dec", "1970 12 01 0:00:00",
+ };
+
+ String CS_DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+
+ "yyyy LLLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 duben 10 16:36:31", "2004 04 10 16:36:31",
+ "yyyy MMMM dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31",
+ "yyyy LLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 4. 10 16:36:31", "2004 04 10 16:36:31",
+ "yyyy LLLL dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 duben 10 16:36:31",
+ "yyyy MMMM dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31",
+ "yyyy LLLL dd H:mm:ss", "pf", "2004 duben 10 16:36:31", "2004 04 10 16:36:31", "2004 duben 10 16:36:31",
+ "yyyy MMMM dd H:mm:ss", "pf", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31",
+
+ "LLLL", "fp", "1970 01 01 0:00:00", "leden", "1970 01 01 0:00:00",
+ "LLLL", "fp", "1970 02 01 0:00:00", "\u00FAnor", "1970 02 01 0:00:00",
+ "LLLL", "fp", "1970 03 01 0:00:00", "b\u0159ezen", "1970 03 01 0:00:00",
+ "LLLL", "fp", "1970 04 01 0:00:00", "duben", "1970 04 01 0:00:00",
+ "LLLL", "fp", "1970 05 01 0:00:00", "kv\u011Bten", "1970 05 01 0:00:00",
+ "LLLL", "fp", "1970 06 01 0:00:00", "\u010Derven", "1970 06 01 0:00:00",
+ "LLLL", "fp", "1970 07 01 0:00:00", "\u010Dervenec", "1970 07 01 0:00:00",
+ "LLLL", "fp", "1970 08 01 0:00:00", "srpen", "1970 08 01 0:00:00",
+ "LLLL", "fp", "1970 09 01 0:00:00", "z\u00E1\u0159\u00ED", "1970 09 01 0:00:00",
+ "LLLL", "fp", "1970 10 01 0:00:00", "\u0159\u00EDjen", "1970 10 01 0:00:00",
+ "LLLL", "fp", "1970 11 01 0:00:00", "listopad", "1970 11 01 0:00:00",
+ "LLLL", "fp", "1970 12 01 0:00:00", "prosinec", "1970 12 01 0:00:00",
+
+ "LLL", "fp", "1970 01 01 0:00:00", "1.", "1970 01 01 0:00:00",
+ "LLL", "fp", "1970 02 01 0:00:00", "2.", "1970 02 01 0:00:00",
+ "LLL", "fp", "1970 03 01 0:00:00", "3.", "1970 03 01 0:00:00",
+ "LLL", "fp", "1970 04 01 0:00:00", "4.", "1970 04 01 0:00:00",
+ "LLL", "fp", "1970 05 01 0:00:00", "5.", "1970 05 01 0:00:00",
+ "LLL", "fp", "1970 06 01 0:00:00", "6.", "1970 06 01 0:00:00",
+ "LLL", "fp", "1970 07 01 0:00:00", "7.", "1970 07 01 0:00:00",
+ "LLL", "fp", "1970 08 01 0:00:00", "8.", "1970 08 01 0:00:00",
+ "LLL", "fp", "1970 09 01 0:00:00", "9.", "1970 09 01 0:00:00",
+ "LLL", "fp", "1970 10 01 0:00:00", "10.", "1970 10 01 0:00:00",
+ "LLL", "fp", "1970 11 01 0:00:00", "11.", "1970 11 01 0:00:00",
+ "LLL", "fp", "1970 12 01 0:00:00", "12.", "1970 12 01 0:00:00",
+ };
+
+ expect(EN_DATA, new Locale("en", "", ""));
+ expect(CS_DATA, new Locale("cs", "", ""));
+ }
+
+ public void TestStandAloneDays()
+ {
+ String EN_DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+
+ "cccc", "fp", "1970 01 04 0:00:00", "Sunday", "1970 01 04 0:00:00",
+ "cccc", "fp", "1970 01 05 0:00:00", "Monday", "1970 01 05 0:00:00",
+ "cccc", "fp", "1970 01 06 0:00:00", "Tuesday", "1970 01 06 0:00:00",
+ "cccc", "fp", "1970 01 07 0:00:00", "Wednesday", "1970 01 07 0:00:00",
+ "cccc", "fp", "1970 01 01 0:00:00", "Thursday", "1970 01 01 0:00:00",
+ "cccc", "fp", "1970 01 02 0:00:00", "Friday", "1970 01 02 0:00:00",
+ "cccc", "fp", "1970 01 03 0:00:00", "Saturday", "1970 01 03 0:00:00",
+
+ "ccc", "fp", "1970 01 04 0:00:00", "Sun", "1970 01 04 0:00:00",
+ "ccc", "fp", "1970 01 05 0:00:00", "Mon", "1970 01 05 0:00:00",
+ "ccc", "fp", "1970 01 06 0:00:00", "Tue", "1970 01 06 0:00:00",
+ "ccc", "fp", "1970 01 07 0:00:00", "Wed", "1970 01 07 0:00:00",
+ "ccc", "fp", "1970 01 01 0:00:00", "Thu", "1970 01 01 0:00:00",
+ "ccc", "fp", "1970 01 02 0:00:00", "Fri", "1970 01 02 0:00:00",
+ "ccc", "fp", "1970 01 03 0:00:00", "Sat", "1970 01 03 0:00:00",
+ };
+
+ String CS_DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+
+ "cccc", "fp", "1970 01 04 0:00:00", "ned\u011Ble", "1970 01 04 0:00:00",
+ "cccc", "fp", "1970 01 05 0:00:00", "pond\u011Bl\u00ED", "1970 01 05 0:00:00",
+ "cccc", "fp", "1970 01 06 0:00:00", "\u00FAter\u00FD", "1970 01 06 0:00:00",
+ "cccc", "fp", "1970 01 07 0:00:00", "st\u0159eda", "1970 01 07 0:00:00",
+ "cccc", "fp", "1970 01 01 0:00:00", "\u010Dtvrtek", "1970 01 01 0:00:00",
+ "cccc", "fp", "1970 01 02 0:00:00", "p\u00E1tek", "1970 01 02 0:00:00",
+ "cccc", "fp", "1970 01 03 0:00:00", "sobota", "1970 01 03 0:00:00",
+
+ "ccc", "fp", "1970 01 04 0:00:00", "ne", "1970 01 04 0:00:00",
+ "ccc", "fp", "1970 01 05 0:00:00", "po", "1970 01 05 0:00:00",
+ "ccc", "fp", "1970 01 06 0:00:00", "\u00FAt", "1970 01 06 0:00:00",
+ "ccc", "fp", "1970 01 07 0:00:00", "st", "1970 01 07 0:00:00",
+ "ccc", "fp", "1970 01 01 0:00:00", "\u010Dt", "1970 01 01 0:00:00",
+ "ccc", "fp", "1970 01 02 0:00:00", "p\u00E1", "1970 01 02 0:00:00",
+ "ccc", "fp", "1970 01 03 0:00:00", "so", "1970 01 03 0:00:00",
+ };
+
+ expect(EN_DATA, new Locale("en", "", ""));
+ expect(CS_DATA, new Locale("cs", "", ""));
+ }
+
+ public void TestNarrowNames()
+ {
+ String EN_DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+
+ "yyyy MMMMM dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",
+ "yyyy LLLLL dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",
+
+ "MMMMM", "1970 01 01 0:00:00", "J",
+ "MMMMM", "1970 02 01 0:00:00", "F",
+ "MMMMM", "1970 03 01 0:00:00", "M",
+ "MMMMM", "1970 04 01 0:00:00", "A",
+ "MMMMM", "1970 05 01 0:00:00", "M",
+ "MMMMM", "1970 06 01 0:00:00", "J",
+ "MMMMM", "1970 07 01 0:00:00", "J",
+ "MMMMM", "1970 08 01 0:00:00", "A",
+ "MMMMM", "1970 09 01 0:00:00", "S",
+ "MMMMM", "1970 10 01 0:00:00", "O",
+ "MMMMM", "1970 11 01 0:00:00", "N",
+ "MMMMM", "1970 12 01 0:00:00", "D",
+
+ "LLLLL", "1970 01 01 0:00:00", "J",
+ "LLLLL", "1970 02 01 0:00:00", "F",
+ "LLLLL", "1970 03 01 0:00:00", "M",
+ "LLLLL", "1970 04 01 0:00:00", "A",
+ "LLLLL", "1970 05 01 0:00:00", "M",
+ "LLLLL", "1970 06 01 0:00:00", "J",
+ "LLLLL", "1970 07 01 0:00:00", "J",
+ "LLLLL", "1970 08 01 0:00:00", "A",
+ "LLLLL", "1970 09 01 0:00:00", "S",
+ "LLLLL", "1970 10 01 0:00:00", "O",
+ "LLLLL", "1970 11 01 0:00:00", "N",
+ "LLLLL", "1970 12 01 0:00:00", "D",
+
+ "EEEEE", "1970 01 04 0:00:00", "S",
+ "EEEEE", "1970 01 05 0:00:00", "M",
+ "EEEEE", "1970 01 06 0:00:00", "T",
+ "EEEEE", "1970 01 07 0:00:00", "W",
+ "EEEEE", "1970 01 01 0:00:00", "T",
+ "EEEEE", "1970 01 02 0:00:00", "F",
+ "EEEEE", "1970 01 03 0:00:00", "S",
+
+ "ccccc", "1970 01 04 0:00:00", "S",
+ "ccccc", "1970 01 05 0:00:00", "M",
+ "ccccc", "1970 01 06 0:00:00", "T",
+ "ccccc", "1970 01 07 0:00:00", "W",
+ "ccccc", "1970 01 01 0:00:00", "T",
+ "ccccc", "1970 01 02 0:00:00", "F",
+ "ccccc", "1970 01 03 0:00:00", "S",
+ };
+
+ String CS_DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+
+ "yyyy LLLLL dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",
+ "yyyy MMMMM dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",
+
+ "MMMMM", "1970 01 01 0:00:00", "l",
+ "MMMMM", "1970 02 01 0:00:00", "\u00FA",
+ "MMMMM", "1970 03 01 0:00:00", "b",
+ "MMMMM", "1970 04 01 0:00:00", "d",
+ "MMMMM", "1970 05 01 0:00:00", "k",
+ "MMMMM", "1970 06 01 0:00:00", "\u010D",
+ "MMMMM", "1970 07 01 0:00:00", "\u010D",
+ "MMMMM", "1970 08 01 0:00:00", "s",
+ "MMMMM", "1970 09 01 0:00:00", "z",
+ "MMMMM", "1970 10 01 0:00:00", "\u0159",
+ "MMMMM", "1970 11 01 0:00:00", "l",
+ "MMMMM", "1970 12 01 0:00:00", "p",
+
+ "LLLLL", "1970 01 01 0:00:00", "l",
+ "LLLLL", "1970 02 01 0:00:00", "\u00FA",
+ "LLLLL", "1970 03 01 0:00:00", "b",
+ "LLLLL", "1970 04 01 0:00:00", "d",
+ "LLLLL", "1970 05 01 0:00:00", "k",
+ "LLLLL", "1970 06 01 0:00:00", "\u010D",
+ "LLLLL", "1970 07 01 0:00:00", "\u010D",
+ "LLLLL", "1970 08 01 0:00:00", "s",
+ "LLLLL", "1970 09 01 0:00:00", "z",
+ "LLLLL", "1970 10 01 0:00:00", "\u0159",
+ "LLLLL", "1970 11 01 0:00:00", "l",
+ "LLLLL", "1970 12 01 0:00:00", "p",
+
+ "EEEEE", "1970 01 04 0:00:00", "N",
+ "EEEEE", "1970 01 05 0:00:00", "P",
+ "EEEEE", "1970 01 06 0:00:00", "\u00DA",
+ "EEEEE", "1970 01 07 0:00:00", "S",
+ "EEEEE", "1970 01 01 0:00:00", "\u010C",
+ "EEEEE", "1970 01 02 0:00:00", "P",
+ "EEEEE", "1970 01 03 0:00:00", "S",
+
+ "ccccc", "1970 01 04 0:00:00", "N",
+ "ccccc", "1970 01 05 0:00:00", "P",
+ "ccccc", "1970 01 06 0:00:00", "\u00DA",
+ "ccccc", "1970 01 07 0:00:00", "S",
+ "ccccc", "1970 01 01 0:00:00", "\u010C",
+ "ccccc", "1970 01 02 0:00:00", "P",
+ "ccccc", "1970 01 03 0:00:00", "S",
+ };
+
+ expectFormat(EN_DATA, new Locale("en", "", ""));
+ expectFormat(CS_DATA, new Locale("cs", "", ""));
+ }
+
+ public void TestEras()
+ {
+ String EN_DATA[] = {
+ "yyyy MM dd",
+
+ "MMMM dd yyyy G", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
+ "MMMM dd yyyy GG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
+ "MMMM dd yyyy GGG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
+ "MMMM dd yyyy GGGG", "fp", "1951 07 17", "July 17 1951 Anno Domini", "1951 07 17",
+
+ "MMMM dd yyyy G", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
+ "MMMM dd yyyy GG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
+ "MMMM dd yyyy GGG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
+ "MMMM dd yyyy GGGG", "fp", "-438 07 17", "July 17 0439 Before Christ", "-438 07 17",
+ };
+
+ expect(EN_DATA, new Locale("en", "", ""));
+ }
+/*
+ public void TestQuarters()
+ {
+ String EN_DATA[] = {
+ "yyyy MM dd",
+
+ "Q", "fp", "1970 01 01", "1", "1970 01 01",
+ "QQ", "fp", "1970 04 01", "02", "1970 04 01",
+ "QQQ", "fp", "1970 07 01", "Q3", "1970 07 01",
+ "QQQQ", "fp", "1970 10 01", "4th quarter", "1970 10 01",
+
+ "q", "fp", "1970 01 01", "1", "1970 01 01",
+ "qq", "fp", "1970 04 01", "02", "1970 04 01",
+ "qqq", "fp", "1970 07 01", "Q3", "1970 07 01",
+ "qqqq", "fp", "1970 10 01", "4th quarter", "1970 10 01",
+ };
+
+ expect(EN_DATA, new Locale("en", "", ""));
+ }
+*/
+
+ /**
+ * Test DateFormat's parsing of default GMT variants. See ticket#6135
+ */
+ public void TestGMTParsing() {
+ String DATA[] = {
+ "HH:mm:ss Z",
+
+ // pattern, input, expected output (in quotes)
+ "HH:mm:ss Z", "10:20:30 GMT+03:00", "10:20:30 +0300",
+ "HH:mm:ss Z", "10:20:30 UT-02:00", "10:20:30 -0200",
+ "HH:mm:ss Z", "10:20:30 GMT", "10:20:30 +0000",
+ "HH:mm:ss vvvv", "10:20:30 UT+10:00", "10:20:30 +1000",
+ "HH:mm:ss zzzz", "10:20:30 UTC", "10:20:30 +0000", // standalone "UTC"
+ "ZZZZ HH:mm:ss", "UT 10:20:30", "10:20:30 +0000",
+ "V HH:mm:ss", "UT+0130 10:20:30", "10:20:30 +0130",
+ "V HH:mm:ss", "UTC+0130 10:20:30", null, // UTC+0130 is not a supported pattern
+ "HH mm Z ss", "10 20 GMT-1100 30", "10:20:30 -1100",
+ };
+ expectParse(DATA, new Locale("en", "", ""));
+ }
+
+ /**
+ * Test parsing. Input is an array that starts with the following
+ * header:
+ *
+ * [0] = pattern string to parse [i+2] with
+ *
+ * followed by test cases, each of which is 3 array elements:
+ *
+ * [i] = pattern, or null to reuse prior pattern
+ * [i+1] = input string
+ * [i+2] = expected parse result (parsed with pattern [0])
+ *
+ * If expect parse failure, then [i+2] should be null.
+ */
+ void expectParse(String[] data, Locale loc) {
+ Date FAIL = null;
+ String FAIL_STR = "parse failure";
+ int i = 0;
+
+ SimpleDateFormat fmt = new SimpleDateFormat("", loc);
+ SimpleDateFormat ref = new SimpleDateFormat(data[i++], loc);
+ SimpleDateFormat gotfmt = new SimpleDateFormat("G yyyy MM dd HH:mm:ss z", loc);
+
+ String currentPat = null;
+ while (i<data.length) {
+ String pattern = data[i++];
+ String input = data[i++];
+ String expected = data[i++];
+
+ if (pattern != null) {
+ fmt.applyPattern(pattern);
+ currentPat = pattern;
+ }
+ String gotstr = FAIL_STR;
+ Date got;
+ try {
+ got = fmt.parse(input);
+ gotstr = gotfmt.format(got);
+ } catch (ParseException e1) {
+ got = FAIL;
+ }
+
+ Date exp = FAIL;
+ String expstr = FAIL_STR;
+ if (expected != null) {
+ expstr = expected;
+ try {
+ exp = ref.parse(expstr);
+ } catch (ParseException e2) {
+ errln("FAIL: Internal test error");
+ }
+ }
+
+ if (got == exp || (got != null && got.equals(exp))) {
+ logln("Ok: " + input + " x " +
+ currentPat + " => " + gotstr);
+ } else {
+ errln("FAIL: " + input + " x " +
+ currentPat + " => " + gotstr + ", expected " +
+ expstr);
+ }
+ }
+ }
+
+ /**
+ * Test formatting. Input is an array of String that starts
+ * with a single 'header' element
+ *
+ * [0] = reference dateformat pattern string (ref)
+ *
+ * followed by test cases, each of which is 4 or 5 elements:
+ *
+ * [i] = test dateformat pattern string (test), or null to reuse prior test pattern
+ * [i+1] = data string A
+ * [i+2] = data string B
+ *
+ * Formats a date, checks the result.
+ *
+ * Examples:
+ * "y/M/d H:mm:ss.SSS", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567"
+ * -- ref.parse A, get t0
+ * -- test.format t0, get r0
+ * -- compare r0 to B, fail if not equal
+ */
+ void expectFormat(String[] data, Locale loc)
+ {
+ int i = 1;
+ String currentPat = null;
+ SimpleDateFormat ref = new SimpleDateFormat(data[0], loc);
+
+ while (i<data.length) {
+ SimpleDateFormat fmt = new SimpleDateFormat("", loc);
+ String pattern = data[i++];
+ if (pattern != null) {
+ fmt.applyPattern(pattern);
+ currentPat = pattern;
+ }
+
+ String datestr = data[i++];
+ String string = data[i++];
+ Date date = null;
+
+ try {
+ date = ref.parse(datestr);
+ } catch (ParseException e) {
+ errln("FAIL: Internal test error; can't parse " + datestr);
+ continue;
+ }
+
+ assertEquals("\"" + currentPat + "\".format(" + datestr + ")",
+ string,
+ fmt.format(date));
+ }
+ }
+
+ /**
+ * Test formatting and parsing. Input is an array of String that starts
+ * with a single 'header' element
+ *
+ * [0] = reference dateformat pattern string (ref)
+ *
+ * followed by test cases, each of which is 4 or 5 elements:
+ *
+ * [i] = test dateformat pattern string (test), or null to reuse prior test pattern
+ * [i+1] = control string, either "fp", "pf", or "F".
+ * [i+2] = data string A
+ * [i+3] = data string B
+ * [i+4] = data string C (not present for 'F' control string)
+ *
+ * Note: the number of data strings depends on the control string.
+ *
+ * fp formats a date, checks the result, then parses the result and checks against a (possibly different) date
+ * pf parses a string, checks the result, then formats the result and checks against a (possibly different) string
+ * F is a shorthand for fp when the second date is the same as the first
+ * P is a shorthand for pf when the second string is the same as the first
+ *
+ * Examples:
+ * (fp) "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.56", "2004 03 10 16:36:31.560",
+ * -- ref.parse A, get t0
+ * -- test.format t0, get r0
+ * -- compare r0 to B, fail if not equal
+ * -- test.parse B, get t1
+ * -- ref.parse C, get t2
+ * -- compare t1 and t2, fail if not equal
+ *
+ * (F) "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567"
+ * -- ref.parse A, get t0
+ * -- test.format t0, get r0
+ * -- compare r0 to B, fail if not equal
+ * -- test.parse B, get t1
+ * -- compare t1 and t0, fail if not equal
+ *
+ * (pf) "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5670",
+ * -- test.parse A, get t0
+ * -- ref.parse B, get t1
+ * -- compare t0 to t1, fail if not equal
+ * -- test.format t1, get r0
+ * -- compare r0 and C, fail if not equal
+ *
+ * (P) "y/M/d H:mm:ss.SSSS", "P", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567"",
+ * -- test.parse A, get t0
+ * -- ref.parse B, get t1
+ * -- compare t0 to t1, fail if not equal
+ * -- test.format t1, get r0
+ * -- compare r0 and A, fail if not equal
+ */
+ void expect(String[] data, Locale loc) {
+ int i = 1;
+ SimpleDateFormat univ = new SimpleDateFormat("EE G yyyy MM dd HH:mm:ss.SSS zzz", loc);
+ String currentPat = null;
+ SimpleDateFormat ref = new SimpleDateFormat(data[0], loc);
+
+ while (i<data.length) {
+ SimpleDateFormat fmt = new SimpleDateFormat("", loc);
+ String pattern = data[i++];
+ if (pattern != null) {
+ fmt.applyPattern(pattern);
+ currentPat = pattern;
+ }
+
+ String control = data[i++];
+
+ if (control.equals("fp") || control.equals("F")) {
+ // 'f'
+ String datestr = data[i++];
+ String string = data[i++];
+ String datestr2 = datestr;
+ if (control.length() == 2) {
+ datestr2 = data[i++];
+ }
+ Date date = null;
+ try {
+ date = ref.parse(datestr);
+ } catch (ParseException e) {
+ errln("FAIL: Internal test error; can't parse " + datestr);
+ continue;
+ }
+ assertEquals("\"" + currentPat + "\".format(" + datestr + ")",
+ string,
+ fmt.format(date));
+ // 'p'
+ if (!datestr2.equals(datestr)) {
+ try {
+ date = ref.parse(datestr2);
+ } catch (ParseException e2) {
+ errln("FAIL: Internal test error; can't parse " + datestr2);
+ continue;
+ }
+ }
+ try {
+ Date parsedate = fmt.parse(string);
+ assertEquals("\"" + currentPat + "\".parse(" + string + ")",
+ univ.format(date),
+ univ.format(parsedate));
+ } catch (ParseException e3) {
+ errln("FAIL: \"" + currentPat + "\".parse(" + string + ") => " +
+ e3);
+ continue;
+ }
+ }
+ else if (control.equals("pf") || control.equals("P")) {
+ // 'p'
+ String string = data[i++];
+ String datestr = data[i++];
+ String string2 = string;
+ if (control.length() == 2) {
+ string2 = data[i++];
+ }
+
+ Date date = null;
+ try {
+ date = ref.parse(datestr);
+ } catch (ParseException e) {
+ errln("FAIL: Internal test error; can't parse " + datestr);
+ continue;
+ }
+ try {
+ Date parsedate = fmt.parse(string);
+ assertEquals("\"" + currentPat + "\".parse(" + string + ")",
+ univ.format(date),
+ univ.format(parsedate));
+ } catch (ParseException e2) {
+ errln("FAIL: \"" + currentPat + "\".parse(" + string + ") => " +
+ e2);
+ continue;
+ }
+ // 'f'
+ assertEquals("\"" + currentPat + "\".format(" + datestr + ")",
+ string2,
+ fmt.format(date));
+ }
+ else {
+ errln("FAIL: Invalid control string " + control);
+ return;
+ }
+ }
+ }
+ /*
+ public void TestJB4757(){
+ DateFormat dfmt = DateFormat.getDateInstance(DateFormat.FULL, ULocale.ROOT);
+ }
+ */
+
+//#if defined(FOUNDATION10) || defined(J2SE13)
+//#else
+ /*
+ * Test case for formatToCharacterIterator
+ */
+ public void TestFormatToCharacterIterator() {
+ // Generate pattern string including all pattern letters with various length
+ AttributedCharacterIterator acit;
+ final char SEPCHAR = '~';
+ String[] patterns = new String[5];
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < patterns.length; i++) {
+ sb.setLength(0);
+ for (int j = 0; j < PATTERN_CHARS.length(); j++) {
+ if (j != 0) {
+ for (int k = 0; k <= i; k++) {
+ sb.append(SEPCHAR);
+ }
+ }
+ char letter = PATTERN_CHARS.charAt(j);
+ for (int k = 0; k <= i; k++) {
+ sb.append(letter);
+ }
+ }
+ patterns[i] = sb.toString();
+ }
+ if (isVerbose()) {
+ for (int i = 0; i < patterns.length; i++) {
+ logln("patterns[" + i + "] = " + patterns[i]);
+ }
+ }
+
+ Calendar cal = Calendar.getInstance();
+ cal.set(2007, Calendar.JULY, 16, 8, 20, 25);
+ cal.set(Calendar.MILLISECOND, 567);
+ final Date d = cal.getTime();
+
+ // Test AttributedCharacterIterator returned by SimpleDateFormat
+ for (int i = 0; i < patterns.length; i++) {
+ SimpleDateFormat sdf = new SimpleDateFormat(patterns[i]);
+ acit = sdf.formatToCharacterIterator(d);
+ int patidx = 0;
+
+ while (true) {
+ Map map = acit.getAttributes();
+ int limit = acit.getRunLimit();
+ if (map.isEmpty()) {
+ // Must be pattern literal - '~'
+ while (acit.getIndex() < limit) {
+ if (acit.current() != SEPCHAR) {
+ errln("FAIL: Invalid pattern literal at " + acit.current() + " in patterns[" + i + "]");
+ }
+ acit.next();
+ }
+ } else {
+ Set keySet = map.keySet();
+ if (keySet.size() == 1) {
+ // Check the attribute
+ Iterator keyIterator = keySet.iterator();
+ DateFormat.Field attr = (DateFormat.Field)keyIterator.next();
+ if (!DATEFORMAT_FIELDS[patidx].equals(attr)) {
+ errln("FAIL: The attribute at " + acit.getIndex() + " in patterns[" + i + "" +
+ "] is " + attr + " - Expected: " + DATEFORMAT_FIELDS[patidx]);
+ }
+ } else {
+ // SimpleDateFormat#formatToCharacterIterator never set multiple
+ // attributes to a single text run.
+ errln("FAIL: Multiple attributes were set");
+ }
+ patidx++;
+ // Move to the run limit
+ acit.setIndex(limit);
+ }
+ if (acit.current() == CharacterIterator.DONE) {
+ break;
+ }
+ }
+ }
+
+ // ChineseDateFormat has pattern letter 'l' for leap month marker in addition to regular DateFormat
+ cal.clear();
+ cal.set(2009, Calendar.JUNE, 22); // 26x78-5-30
+ Date nonLeapMonthDate = cal.getTime(); // non-leap month
+ cal.set(2009, Calendar.JUNE, 23); // 26x78-5*-1
+ Date leapMonthDate = cal.getTime(); // leap month
+
+ ChineseDateFormat cdf = new ChineseDateFormat("y'x'G-Ml-d", ULocale.US);
+ acit = cdf.formatToCharacterIterator(nonLeapMonthDate);
+ Set keys = acit.getAllAttributeKeys();
+ if (keys.contains(ChineseDateFormat.Field.IS_LEAP_MONTH)) {
+ errln("FAIL: IS_LEAP_MONTH attribute must not present for Chinese calendar date "
+ + cdf.format(nonLeapMonthDate));
+ }
+ acit = cdf.formatToCharacterIterator(leapMonthDate);
+ keys = acit.getAllAttributeKeys();
+ if (!keys.contains(ChineseDateFormat.Field.IS_LEAP_MONTH)) {
+ errln("FAIL: IS_LEAP_MONTH attribute must present for Chinese calendar date "
+ + cdf.format(leapMonthDate));
+ }
+ }
+
+ /*
+ * API coverage test case for formatToCharacterIterator
+ */
+ public void TestFormatToCharacterIteratorCoverage() {
+ // Calling formatToCharacterIterator, using various argument types
+ DateFormat df = DateFormat.getDateTimeInstance();
+ AttributedCharacterIterator acit = null;
+
+ Calendar cal = Calendar.getInstance();
+ try {
+ acit = df.formatToCharacterIterator(cal);
+ if (acit == null) {
+ errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(Calendar)");
+ }
+ } catch (IllegalArgumentException iae) {
+ errln("FAIL: Calendar must be accepted by formatToCharacterIterator");
+ }
+
+ Date d = cal.getTime();
+ try {
+ acit = df.formatToCharacterIterator(d);
+ if (acit == null) {
+ errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(Date)");
+ }
+ } catch (IllegalArgumentException iae) {
+ errln("FAIL: Date must be accepted by formatToCharacterIterator");
+ }
+
+ Number num = new Long(d.getTime());
+ try {
+ acit = df.formatToCharacterIterator(num);
+ if (acit == null) {
+ errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(Number)");
+ }
+ } catch (IllegalArgumentException iae) {
+ errln("FAIL: Number must be accepted by formatToCharacterIterator");
+ }
+
+ boolean isException = false;
+ String str = df.format(d);
+ try {
+ acit = df.formatToCharacterIterator(str);
+ if (acit == null) {
+ errln("FAIL: null AttributedCharacterIterator returned by formatToCharacterIterator(String)");
+ }
+ } catch (IllegalArgumentException iae) {
+ logln("IllegalArgumentException is thrown by formatToCharacterIterator");
+ isException = true;
+ }
+ if (!isException) {
+ errln("FAIL: String must not be accepted by formatToCharacterIterator");
+ }
+
+ // DateFormat.Field#ofCalendarField and getCalendarField
+ for (int i = 0; i < DATEFORMAT_FIELDS.length; i++) {
+ int calField = DATEFORMAT_FIELDS[i].getCalendarField();
+ if (calField != -1) {
+ DateFormat.Field field = DateFormat.Field.ofCalendarField(calField);
+ if (field != DATEFORMAT_FIELDS[i]) {
+ errln("FAIL: " + field + " is returned for a Calendar field " + calField
+ + " - Expected: " + DATEFORMAT_FIELDS[i]);
+ }
+ }
+ }
+
+ // IllegalArgument for ofCalendarField
+ isException = false;
+ try {
+ DateFormat.Field.ofCalendarField(-1);
+ } catch (IllegalArgumentException iae) {
+ logln("IllegalArgumentException is thrown by ofCalendarField");
+ isException = true;
+ }
+ if (!isException) {
+ errln("FAIL: IllegalArgumentException must be thrown by ofCalendarField for calendar field value -1");
+ }
+
+ // ChineseDateFormat.Field#ofCalendarField and getCalendarField
+ int ccalField = ChineseDateFormat.Field.IS_LEAP_MONTH.getCalendarField();
+ if (ccalField != ChineseCalendar.IS_LEAP_MONTH) {
+ errln("FAIL: ChineseCalendar field " + ccalField + " is returned for ChineseDateFormat.Field.IS_LEAP_MONTH.getCalendarField()");
+ } else {
+ DateFormat.Field cfield = ChineseDateFormat.Field.ofCalendarField(ccalField);
+ if (cfield != ChineseDateFormat.Field.IS_LEAP_MONTH) {
+ errln("FAIL: " + cfield + " is returned for a ChineseCalendar field " + ccalField
+ + " - Expected: " + ChineseDateFormat.Field.IS_LEAP_MONTH);
+ }
+ }
+ }
+//#endif
+
+ /*
+ * Test for checking SimpleDateFormat/DateFormatSymbols creation
+ * honor the calendar keyword in the given locale. See ticket#6100
+ */
+ public void TestCalendarType() {
+ final String testPattern = "GGGG y MMMM d EEEE";
+
+ final ULocale[] testLocales = {
+ new ULocale("de"),
+ new ULocale("fr_FR@calendar=gregorian"),
+ new ULocale("en@calendar=islamic"),
+ new ULocale("ja_JP@calendar=japanese"),
+ new ULocale("zh_Hans_CN@calendar=bogus"),
+ };
+
+ SimpleDateFormat[] formatters = new SimpleDateFormat[5];
+ for (int i = 0; i < testLocales.length; i++) {
+ // Create a locale with no keywords
+ StringBuffer locStrBuf = new StringBuffer();
+ if (testLocales[i].getLanguage().length() > 0) {
+ locStrBuf.append(testLocales[i].getLanguage());
+ }
+ if (testLocales[i].getScript().length() > 0) {
+ locStrBuf.append('_');
+ locStrBuf.append(testLocales[i].getScript());
+ }
+ if (testLocales[i].getCountry().length() > 0) {
+ locStrBuf.append('_');
+ locStrBuf.append(testLocales[i].getCountry());
+ }
+ ULocale locNoKeywords = new ULocale(locStrBuf.toString());
+
+ Calendar cal = Calendar.getInstance(testLocales[i]);
+
+ // Calendar getDateFormat method
+ DateFormat df = cal.getDateTimeFormat(DateFormat.MEDIUM, DateFormat.MEDIUM, locNoKeywords);
+ if (df instanceof SimpleDateFormat) {
+ formatters[0] = (SimpleDateFormat)df;
+ formatters[0].applyPattern(testPattern);
+ } else {
+ formatters[0] = null;
+ }
+
+ // DateFormat constructor with locale
+ df = DateFormat.getDateInstance(DateFormat.MEDIUM, testLocales[i]);
+ if (df instanceof SimpleDateFormat) {
+ formatters[1] = (SimpleDateFormat)df;
+ formatters[1].applyPattern(testPattern);
+ } else {
+ formatters[1] = null;
+ }
+
+ // DateFormat constructor with Calendar
+ df = DateFormat.getDateInstance(cal, DateFormat.MEDIUM, locNoKeywords);
+ if (df instanceof SimpleDateFormat) {
+ formatters[2] = (SimpleDateFormat)df;
+ formatters[2].applyPattern(testPattern);
+ } else {
+ formatters[2] = null;
+ }
+
+ // SimpleDateFormat constructor
+ formatters[3] = new SimpleDateFormat(testPattern, testLocales[i]);
+
+ // SimpleDateFormat with DateFormatSymbols
+ DateFormatSymbols dfs = new DateFormatSymbols(testLocales[i]);
+ formatters[4] = new SimpleDateFormat(testPattern, dfs, testLocales[i]);
+
+ // All SimpleDateFormat instances should produce the exact
+ // same result.
+ String expected = null;
+ Date d = new Date();
+ for (int j = 0; j < formatters.length; j++) {
+ if (formatters[j] != null) {
+ String tmp = formatters[j].format(d);
+ if (expected == null) {
+ expected = tmp;
+ } else if (!expected.equals(tmp)) {
+ errln("FAIL: formatter[" + j + "] returned \"" + tmp + "\" in locale " +
+ testLocales[i] + " - expected: " + expected);
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Test for format/parse method with calendar which is different
+ * from what DateFormat instance internally use. See ticket#6420.
+ */
+ public void TestRoundtripWithCalendar() {
+ TimeZone tz = TimeZone.getTimeZone("Europe/Paris");
+ TimeZone gmt = TimeZone.getTimeZone("Etc/GMT");
+
+ final Calendar[] calendars = {
+ new GregorianCalendar(tz),
+ new BuddhistCalendar(tz),
+ new HebrewCalendar(tz),
+ new IslamicCalendar(tz),
+ new JapaneseCalendar(tz),
+ };
+
+ final String pattern = "GyMMMMdEEEEHHmmssVVVV";
+
+ //FIXME The formatters commented out below are currently failing because of
+ // the calendar calculation problem reported by #6691
+
+ // The order of test formatters mus match the order of calendars above.
+ final DateFormat[] formatters = {
+ DateFormat.getPatternInstance(pattern, new ULocale("en_US")), //calendar=gregorian
+ DateFormat.getPatternInstance(pattern, new ULocale("th_TH")), //calendar=buddhist
+ DateFormat.getPatternInstance(pattern, new ULocale("he_IL@calendar=hebrew")),
+// DateFormat.getPatternInstance(pattern, new ULocale("ar_EG@calendar=islamic")),
+// DateFormat.getPatternInstance(pattern, new ULocale("ja_JP@calendar=japanese")),
+ };
+
+ Date d = new Date();
+ StringBuffer buf = new StringBuffer();
+ FieldPosition fpos = new FieldPosition(0);
+ ParsePosition ppos = new ParsePosition(0);
+
+ for (int i = 0; i < formatters.length; i++) {
+ buf.setLength(0);
+ fpos.setBeginIndex(0);
+ fpos.setEndIndex(0);
+ calendars[i].setTime(d);
+
+ // Normal case output - the given calendar matches the calendar
+ // used by the formatter
+ formatters[i].format(calendars[i], buf, fpos);
+ String refStr = buf.toString();
+
+ for (int j = 0; j < calendars.length; j++) {
+ if (j == i) {
+ continue;
+ }
+ buf.setLength(0);
+ fpos.setBeginIndex(0);
+ fpos.setEndIndex(0);
+ calendars[j].setTime(d);
+
+ // Even the different calendar type is specified,
+ // we should get the same result.
+ formatters[i].format(calendars[j], buf, fpos);
+ if (!refStr.equals(buf.toString())) {
+ errln("FAIL: Different format result with a different calendar for the same time -"
+ + "\n Reference calendar type=" + calendars[i].getType()
+ + "\n Another calendar type=" + calendars[j].getType()
+ + "\n Expected result=" + refStr
+ + "\n Actual result=" + buf.toString());
+ }
+ }
+
+ calendars[i].setTimeZone(gmt);
+ calendars[i].clear();
+ ppos.setErrorIndex(-1);
+ ppos.setIndex(0);
+
+ // Normal case parse result - the given calendar matches the calendar
+ // used by the formatter
+ formatters[i].parse(refStr, calendars[i], ppos);
+
+ for (int j = 0; j < calendars.length; j++) {
+ if (j == i) {
+ continue;
+ }
+ calendars[j].setTimeZone(gmt);
+ calendars[j].clear();
+ ppos.setErrorIndex(-1);
+ ppos.setIndex(0);
+
+ // Even the different calendar type is specified,
+ // we should get the same time and time zone.
+ formatters[i].parse(refStr, calendars[j], ppos);
+ if (calendars[i].getTimeInMillis() != calendars[j].getTimeInMillis()
+ || !calendars[i].getTimeZone().equals(calendars[j].getTimeZone())) {
+ errln("FAIL: Different parse result with a different calendar for the same string -"
+ + "\n Reference calendar type=" + calendars[i].getType()
+ + "\n Another calendar type=" + calendars[j].getType()
+ + "\n Date string=" + refStr
+ + "\n Expected time=" + calendars[i].getTimeInMillis()
+ + "\n Expected time zone=" + calendars[i].getTimeZone().getID()
+ + "\n Actual time=" + calendars[j].getTimeInMillis()
+ + "\n Actual time zone=" + calendars[j].getTimeZone().getID());
+ }
+ }
+ }
+ }
+
+ // based on TestRelativeDateFormat() in icu/trunk/source/test/cintltst/cdattst.c
+ public void TestRelativeDateFormat() {
+ ULocale loc = ULocale.US;
+ TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
+ Calendar cal = new GregorianCalendar(tz, loc);
+ Date now = new Date();
+ cal.setTime(now);
+ cal.set(Calendar.HOUR_OF_DAY, 18);
+ cal.set(Calendar.MINUTE, 49);
+ cal.set(Calendar.SECOND, 0);
+ Date today = cal.getTime();
+ String minutesStr = "49"; // minutes string to search for in formatted result
+ int[] dateStylesList = { DateFormat.RELATIVE_FULL, DateFormat.RELATIVE_LONG, DateFormat.RELATIVE_MEDIUM, DateFormat.RELATIVE_SHORT };
+
+ for (int i = 0; i < dateStylesList.length; i++) {
+ int dateStyle = dateStylesList[i];
+ DateFormat fmtRelDateTime = DateFormat.getDateTimeInstance(dateStyle, DateFormat.SHORT, loc);
+ DateFormat fmtRelDate = DateFormat.getDateInstance(dateStyle, loc);
+ DateFormat fmtTime = DateFormat.getTimeInstance(DateFormat.SHORT, loc);
+
+ for (int dayOffset = -2; dayOffset <= 2; dayOffset++ ) {
+ StringBuffer dateTimeStr = new StringBuffer(64);
+ StringBuffer dateStr = new StringBuffer(64);
+ StringBuffer timeStr = new StringBuffer(64);
+ FieldPosition fp = new FieldPosition(DateFormat.MINUTE_FIELD);
+ cal.setTime(today);
+ cal.add(Calendar.DATE, dayOffset);
+
+ fmtRelDateTime.format(cal, dateTimeStr, fp);
+ fmtRelDate.format(cal, dateStr, new FieldPosition(0) );
+ fmtTime.format(cal, timeStr, new FieldPosition(0) );
+
+ // check that dateStr is in dateTimeStr
+ if ( dateTimeStr.toString().indexOf( dateStr.toString() ) < 0 ) {
+ errln("relative date string not found in datetime format with timeStyle SHORT, dateStyle " +
+ dateStyle + " for dayOffset " + dayOffset );
+ errln("datetime format is " + dateTimeStr.toString() + ", date string is " + dateStr.toString() );
+ }
+ // check that timeStr is in dateTimeStr
+ if ( dateTimeStr.toString().indexOf( timeStr.toString() ) < 0 ) {
+ errln("short time string not found in datetime format with timeStyle SHORT, dateStyle " +
+ dateStyle + " for dayOffset " + dayOffset );
+ errln("datetime format is " + dateTimeStr.toString() + ", time string is " + timeStr.toString() );
+ }
+ // check index of minutesStr
+ int minutesStrIndex = dateTimeStr.toString().indexOf( minutesStr );
+ if ( fp.getBeginIndex() != minutesStrIndex ) {
+ errln("FieldPosition beginIndex " + fp.getBeginIndex() + " instead of " + minutesStrIndex + " for datetime format with timeStyle SHORT, dateStyle " +
+ dateStyle + " for dayOffset " + dayOffset );
+ errln("datetime format is " + dateTimeStr.toString() );
+ }
+ }
+ }
+ }
+
+ public void Test6880() {
+ Date d1, d2, dp1, dp2, dexp1, dexp2;
+ String s1, s2;
+
+ TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
+ GregorianCalendar gcal = new GregorianCalendar(tz);
+
+ gcal.clear();
+ gcal.set(1910, Calendar.JANUARY, 1, 12, 00); // offset 8:05:52
+ d1 = gcal.getTime();
+
+ gcal.clear();
+ gcal.set(1950, Calendar.JANUARY, 1, 12, 00); // offset 8:00
+ d2 = gcal.getTime();
+
+ gcal.clear();
+ gcal.set(1970, Calendar.JANUARY, 1, 12, 00);
+ dexp2 = gcal.getTime();
+ dexp1 = new Date(dexp2.getTime() - (5*60 + 52)*1000); // subtract 5m52s
+
+ DateFormat fmt = DateFormat.getTimeInstance(DateFormat.FULL, new ULocale("zh"));
+ fmt.setTimeZone(tz);
+
+ s1 = fmt.format(d1);
+ s2 = fmt.format(d2);
+
+ try {
+ dp1 = fmt.parse(s1);
+ dp2 = fmt.parse(s2);
+
+ if (!dp1.equals(dexp1)) {
+ errln("FAIL: Failed to parse " + s1 + " parsed: " + dp1 + " expected: " + dexp1);
+ }
+ if (!dp2.equals(dexp2)) {
+ errln("FAIL: Failed to parse " + s2 + " parsed: " + dp2 + " expected: " + dexp2);
+ }
+ } catch (ParseException pe) {
+ errln("FAIL: Parse failure");
+ }
+ }
+}