1

If I have a TimeZone, the string property currently produces the time zone in ISO-8601 format.

import ceylon.time.timezone {
    OffsetTimeZone
}

shared void run() {
    value timezone = OffsetTimeZone(27000000);
    print(timezone.string); // +07:30
}

Is there a way to get it in other formats, specifically without the colon (e.g. +0730)? (I mean, other than dropping the fourth character.) The ceylon.time.timezone.timeZone.parse function accepts offsets in this format, but I cannot figure out how to get them back.

drhagen
  • 8,331
  • 8
  • 53
  • 82
  • I was the author of ceylon.time library and I am almost certain that .string method should return the right offset. If it doesn’t it is most likely a bug and you should report it. – Roland Tepp Apr 08 '18 at 09:17
  • @RolandTepp It currently returns the correct offset. I just want to know if there is a way to control the formatting. – drhagen Apr 08 '18 at 09:59

1 Answers1

0

There’s more detailed formatting support in ceylon.locale module. See Formats type documentation.

Well, to be completely honest, it doesn’t give you a detailed formatting options that one might be used to when formatting dates in Java. You have basically just choices of short, medium and long date format and not much more.

Roland Tepp
  • 8,301
  • 11
  • 55
  • 73
  • Unfortunately, the `Formats` class of `ceylon.locale` isn't really set up so that you can provide your own formats directly to `longFormatTime()`, so I don't think it's really very helpful, unfortunately. – Gavin King Apr 08 '18 at 16:53
  • At the moment that is the best we have though. – Roland Tepp Apr 08 '18 at 20:27