title: Display ICU UDate formatted for different timezones
body: <p>In the following example, I would like to format <strong>EPOCH (1/1/1970)</strong> in different time zones.  For example, I may wish to format EPOCH using the <strong>Los Angeles time zone</strong> and/or format EPOCH using the <strong>New York timezone</strong>.</p>
  
  <pre><code>UErrorCode uErrorCode = U_ZERO_ERROR;
  UnicodeString unicodeString;
  UDate uDate;
  
  icu::Locale locale = icu::Locale("en");
  TimeZone* timeZone = TimeZone::createTimeZone("America/Los_Angeles");
  Calendar* calendar = Calendar::createInstance(timeZone, uErrorCode);
  
  // setting calendar to EPOCH, e.g. zero MS from 1/1/1970
  calendar-&gt;setTime(0, uErrorCode);
  
  // get calendar time as milliseconds (UDate)
  uDate = calendar-&gt;getTime(uErrorCode);
  
  DateFormat* dateFormat = DateFormat::createDateTimeInstance(
      icu::DateFormat::MEDIUM,    // date style
      icu::DateFormat::SHORT,     // time style
      locale);
  
  unicodeString = dateFormat-&gt;format(uDate, unicodeString, uErrorCode);
  
  std::string str;
  unicodeString.toUTF8String(str);
  std::cout &lt;&lt; "Date: " &lt;&lt; str;
  
  // Use getOffset to get the stdOffset and dstOffset for the given time
  int32_t stdOffset, dstOffset;
  timeZone-&gt;getOffset(uDate, true, stdOffset, dstOffset, uErrorCode);
  std::cout &lt;&lt; " | ";
  std::cout &lt;&lt; "Time zone STD offset: " &lt;&lt; stdOffset / (1000 * 60 * 60) &lt;&lt; " | ";
  std::cout &lt;&lt; "Time zone DST offset: " &lt;&lt; dstOffset / (1000 * 60 * 60) &lt;&lt; std::endl;
  </code></pre>
  
  <p>The problem that I have is that the output is not formatted respective to the time zone.</p>
  
  <p>Here is the output when using the <strong>Los Angeles</strong> time zone:</p>
  
  <p>Date: <strong>Dec 31, 1969, 6:00 PM</strong> | Time zone STD offset: <strong>-8</strong> | Time zone DST offset: 0</p>
  
  <p>Here is the output when using the <strong>New York</strong> time zone:</p>
  
  <p>Date: <strong>Dec 31, 1969, 6:00 PM</strong> | Time zone STD offset: <strong>-5</strong> | Time zone DST offset: 0</p>
  
  <p>Please notice that the date is not EPOCH and secondly notice that the dates and times for both outputs are identical.  The <strong>offsets are correct</strong>, but the <strong>date/time display is not</strong>.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>It is important to note that the displayed date/time is 6 hours behind since I'm currently (<strong>-6 UTC</strong>) meaning that you ADD <strong>6 hours</strong> to <strong>Dec. 31, 1969 at 6:00PM</strong> which would then equal <strong>EPOCH Jan. 1, 1970 12:00AM</strong>.</p>
  
  <p>ICU is using my PC's timezone automatically since I have found no way to specify timezone when formatting date/time using <strong>DateFormat::Format(...)</strong>.  If <strong>format()</strong> accepted a timezone argument to override my PC's local timezone, I would not be having this issue.  </p>