Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way for format a time currently? #200

Closed
joreilly opened this issue May 5, 2022 · 1 comment
Closed

Way for format a time currently? #200

joreilly opened this issue May 5, 2022 · 1 comment

Comments

@joreilly
Copy link

joreilly commented May 5, 2022

Given code like following (used in Android), is there way right now to do something equivalent in shared Kotlin Multiplatform code using Kotlinx Datetime (given a LocalDateTime)

        val date = df.parse(startDate)

        val timeFormatter = SimpleDateFormat("HH:mm")
        return timeFormatter.format(date)
@ilya-g
Copy link
Member

ilya-g commented May 5, 2022

No, there's no multiplatform way to format date and time with custom formats, only ISO-8601 is supported out of the box.
The current workaround is to declare expect formatting functions and implement them with those actual formatting API available in the target platforms.
You can follow issues labelled with the formatters Related to parsing and formatting label to track the state of formatting support in this library.

@ilya-g ilya-g closed this as completed May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants