Ticket #5895 (closed defect: fixed)

Bug contains 3 commit(s) | SVN Diffs for #5895

 

Opened 3 years ago

Last modified 2 years ago

Parsed time zone is not properly set in the result calendar

Reported by: yoshito Assigned to: yoshito
Priority: major Milestone: 3.8.1
Component: formatting Version:
Keywords: Cc:
Load: Xref: 5893,5990
Java Version: Operating System:
Project (C/J): all Weeks: 0.2
Review: emmons

Description

With the test code below, proper time zone is not set in the calendar returned by parse.

import java.text.ParsePosition;
import java.util.Date;

import com.ibm.icu.text.SimpleDateFormat;
import com.ibm.icu.util.Calendar;
import com.ibm.icu.util.TimeZone;
import com.ibm.icu.util.ULocale;

public class TimeZoneRoundTrip {
	public static void main(String[] args) {
		Date d = new Date();
		String tzid1 = "America/Los_Angeles";

		System.out.println(tzid1);

		SimpleDateFormat sdf = new SimpleDateFormat("z", ULocale.US);
		sdf.setTimeZone(TimeZone.getTimeZone(tzid1));

		String tzstr = sdf.format(d);
		System.out.println(tzstr);

		Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Asia/Tokyo"), ULocale.US);
		sdf.parse(tzstr, cal, new ParsePosition(0));
		String tzid2 = cal.getTimeZone().getID();
		System.out.println(tzid2);
	}
}

With this test code, output is -

America/Los_Angeles
PDT
Asia/Tokyo

This ticket is for pattern 'z' and 'zzzz'. Because we want to isolate this issue from other parsing issue discussed in #5893, I created this ticket.

Attachments

Change History

08/30/07 11:50:56 changed by yoshito

  • milestone changed from 3.8 to 4.0.

will tackle bigger problems after 3.8.

09/28/07 14:41:34 changed by yoshito

  • weeks set to 0.2.

09/28/07 14:41:44 changed by yoshito

  • component changed from unknown to formatting.

11/28/07 13:12:43 changed by yoshito

  • xref changed from 5893 to 5893,5990.

11/28/07 13:28:09 changed by yoshito

  • status changed from new to assigned.
  • revw set to emmons.
  • milestone changed from 4.0 to 3.8.1.

The change sets associated with this ticket http://bugs.icu-project.org/trac/search?q=%22ticket:5895:%22&noquickjump=1&changeset=on do not contain all the fixes. The rest of work was done as a part of #5990.

01/04/08 12:06:48 changed by emmons

  • status changed from assigned to closed.
  • resolution set to fixed.

Add/Change #5895 (Parsed time zone is not properly set in the result calendar)




Anti spam check: