Ticket #5559 (closed defect: fixed)

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

 

Opened 2 years ago

Last modified 1 year ago

TimeZone.getTimeZone with custom timezone id (e.g. GMT+03:00)

Reported by: yoshito_umaoka@... Assigned to: yoshito
Priority: minor Milestone: 3.8
Component: time_calc Version: 3.6
Keywords: Cc:
Load: Xref:
Java Version: Operating System:
Project (C/J): ICU4J,ICU4C Weeks:
Review: srl

Description

ICU4J TimeZone class accepts custom timezone id using following syntax.

GMT[+|-]hh[[:]mm]

This is compatible with JDK implementation. In the JDK implementation, when you specify such timezone id in TimeZone.getTimeZone(String), normalized version of custom timezone id is set in the returned TimeZone object. However, ICU implementation always use "Custom" as its timezone id instead of GMT[+|-]hh[[:]mm]. The ICU implementation should also preserve syntax based timezone id like JDK.

Attachments

Change History

01/16/07 07:26:32 changed by yoshito

  • owner changed from somebody to yoshito.
  • status changed from new to assigned.
  • weeks changed.
  • xref changed.
  • revw changed.

01/18/07 07:15:38 changed by yoshito

  • project changed from ICU4J to ICU4J,ICU4C.

In ICU core meeting on Jan 18, 2007, we agreed that we'll make following changes in custom tzid parsing/normalization.

1) If specified tzid is using custom time zone id syntax (GMT[+|-]h[h][[:]mm]), TimeZone.getTimeZone(String tzid) will return an instance of TimeZone and its tzid (TimeZone.getID()) will be normalized version of custom time zone id - GMT[+|-]hhmm (RFC822 format), instead of "Custom". This behavior is NOT 100% compatible with Java TimeZone.getTimeZone(String tzid) implementation, but Java can still parse RFC822 format properly, so there is no interoperability issues.

2) Syntax of custom time zone id which is properly parsed by ICU is GMT[+|-]h[h][[:]mm]. Details are below -

a. "GMT" can be lower or upper case, or mixed. Followings are all valid prefix -> "GMT" "gmt" "Gmt" "gmT"...
b. Sign must be '+' or '-' and always required
c. Hours can be represented by single digit or double digit. The valid range is 0 - 23, either having leading zero for offset < 10 or no leading zero. RFC822 definition allows hours up to 99, but ICU set its own "practical" limitation.
d. Minutes is optional, but when supplied, it is always 2-digit number. The valid minutes range is 0 - 59.
e.Colon between hours and minutes is optional. When no minutes is provided, colon after hours is invalid.
f. No extra characters after the last offset number (either hours/minutes) are allowed. For example, "GMT+0900J" is invalid.
g. Only US-ASCII digits (U+0030 - U+0039) are used for hours/minutes.

3) This change will be also applied to ICU4C (TimeZone::createTimeZone(const UnicodeString&)).

02/06/07 08:29:03 changed by grhoten

  • priority changed from major to minor.
  • milestone set to 3.8.

08/14/07 10:29:42 changed by yoshito

  • load changed.
  • revw set to srl.

08/17/07 19:39:31 changed by srl

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

Add/Change #5559 (TimeZone.getTimeZone with custom timezone id (e.g. GMT+03:00))




Anti spam check: