]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/intltest/caltztst.cpp
ICU-400.38.tar.gz
[apple/icu.git] / icuSources / test / intltest / caltztst.cpp
index b9c438671deb96b84bbf74496c4e68d9809688b2..3d50ce954c21fb968691cd0885489c2f18152564 100644 (file)
@@ -152,6 +152,25 @@ CalendarTimeZoneTest::dateToString(UDate d, UnicodeString& str)
     return str;
 }
 
+UnicodeString&
+CalendarTimeZoneTest::dateToString(UDate d, UnicodeString& str,
+                                   const TimeZone& tz)
+{
+    str.remove();
+    DateFormat* format = getDateFormat();
+    if (format == 0)
+    {
+        str += "DATE_FORMAT_FAILURE";
+        return str;
+    }
+    TimeZone* save = format->getTimeZone().clone();
+    format->setTimeZone(tz);
+    format->format(d, str);
+    format->adoptTimeZone(save);
+    releaseDateFormat(format);
+    return str;
+}
+
 // Utility methods to create a date.  This is useful for converting Java constructs
 // which create a Date object.
 UDate