ADDITIONAL SYSTEM INFORMATION :
No additional configuration.
A DESCRIPTION OF THE PROBLEM :
The [`DateTimeFormatter` JavaDoc][1] explicitly states that when I use the `OOOO` pattern in my formatter, the **full form** of localized timezone should be used (emphasis mine):
> Four letters outputs the full form, which is localized offset text, such as 'GMT, **with 2-digit hour and minute field**, optional second field if non-zero, and colon, for example 'GMT+08:00'.
But in case the time is in GMT+0, the full form is not output, but instead just `GMT`.
Note: See the related [Stackoverflow question][2]
[1]: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
[2]: https://stackoverflow.com/q/54875992/2237467
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the executable test case.
2. Observe the output string.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Wed 2019.02.27 15:55:38.177 GMT+00:00
ACTUAL -
Wed 2019.02.27 15:55:38.177 GMT
---------- BEGIN SOURCE ----------
package main;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
public class Main {
public static void main(String[] args) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE yyyy.MM.dd HH:mm:ss.SSS OOOO");
String timestamp = OffsetDateTime.ofInstant(Instant.now(), ZoneOffset.UTC).format(formatter);
System.out.println(timestamp);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Using the timezone pattern `'GMT'xxxxx` instead of `OOOO`, which involves explicitly specifying the hard-coded substring `GMT` into the pattern.
FREQUENCY : always
No additional configuration.
A DESCRIPTION OF THE PROBLEM :
The [`DateTimeFormatter` JavaDoc][1] explicitly states that when I use the `OOOO` pattern in my formatter, the **full form** of localized timezone should be used (emphasis mine):
> Four letters outputs the full form, which is localized offset text, such as 'GMT, **with 2-digit hour and minute field**, optional second field if non-zero, and colon, for example 'GMT+08:00'.
But in case the time is in GMT+0, the full form is not output, but instead just `GMT`.
Note: See the related [Stackoverflow question][2]
[1]: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
[2]: https://stackoverflow.com/q/54875992/2237467
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the executable test case.
2. Observe the output string.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Wed 2019.02.27 15:55:38.177 GMT+00:00
ACTUAL -
Wed 2019.02.27 15:55:38.177 GMT
---------- BEGIN SOURCE ----------
package main;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
public class Main {
public static void main(String[] args) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE yyyy.MM.dd HH:mm:ss.SSS OOOO");
String timestamp = OffsetDateTime.ofInstant(Instant.now(), ZoneOffset.UTC).format(formatter);
System.out.println(timestamp);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Using the timezone pattern `'GMT'xxxxx` instead of `OOOO`, which involves explicitly specifying the hard-coded substring `GMT` into the pattern.
FREQUENCY : always
- csr for
-
JDK-8226308 Timezone pattern "OOOO" does not result in the full "GMT+00:00" substring
-
- Closed
-