0

The following code return in english format however I want arabic
currentDate.format(DateFormatter)
currentTime.format(TimeFormatter)

example:
expected: ١٢:٠٠
actual: 12:00

...
        var dateString: String = ""
        var timeString: String = ""
...

        val DateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL).withLocale(Locale( "ar"))
        val TimeFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale( "ar"))

        val currentDate = LocalDate.now()
        val currentTime = LocalTime.now()


        dateString = currentDate.format(DateFormatter)
        timeString = currentTime.format(TimeFormatter)
...

Paruyr
  • 37
  • 1
  • 8
  • 1
    I wrote a answer similar to this sometime ago, you can look into that - [how-to-show-date-format-in-both-english-and-arabic](https://stackoverflow.com/questions/70065793/how-to-show-date-format-in-both-english-and-arabic/70066026#70066026) – Nitish Jan 20 '22 at 09:20

1 Answers1

0
val DateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL).withDecimalStyle(DecimalStyle.of(Locale("ar")))
val TimeFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withDecimalStyle(DecimalStyle.of(Locale("ar")))
Paruyr
  • 37
  • 1
  • 8