0

I am creating a workaround to fix the SimpleDateFormat "clone" class of Codename One (CN1) in my app.

I need to handle the XXX format value to get the ISO time-zone.

How can it be calculated?

(I cannot use the SimpleDateFormat class bundled with Java, nor other classes from pure Java that have not been cloned in CodenameOne.)

Examples from Oracle are

Z   Time zone   RFC 822 time zone   -0800
X   Time zone   ISO 8601 time zone  -08; -0800; -08:00

(I see that the XXX output could be different in some cases but I do not know what they are. Maybe they corresponds to X, XX, XXX formats)

Android examples are the same. I need to manage formats with X value. Maybe they are X, XX, XXX.

Examples have XXX syntax in fact, like in

HH:mm:ss.SSSXXX

I just need the compatibility with Android from the other available values.

I do not know what's the algorithm to calculate the ISO Time-Zone.

CN1 Calendar class can be used, with some other instructions.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
P5music
  • 3,197
  • 2
  • 32
  • 81
  • While I do not know Codename One at all, I notice that its Javadoc shows *both* its own [`SimpleDateFormat`](https://codenameone.com/javadoc/com/codename1/l10n/SimpleDateFormat.html) as well as the old Java class [`SimpleDateFormat`](https://codenameone.com/javadoc/java/text/SimpleDateFormat.html). Can you not switch between them? (Admittedly, a naïve question on my part.) – Basil Bourque Sep 01 '21 at 21:29
  • The java.util one is problematic. It will work correctly where we run on top of a "real" JVM like Android, JavaSE etc. but when translating to iOS it will run on an outdated version that's even worse. That's the reason we moved it to our own package. This gives 100% compatibility across platforms. Our focus has been on the much simpler `L10Manager` class which uses device native formatting APIs for most cases. Ideally at some point we'll be able to port ThreeTenABP, there's an RFE https://github.com/codenameone/CodenameOne/issues/1763 someone already did the streams part there... – Shai Almog Sep 02 '21 at 01:49

0 Answers0