Switch Arabic Numbers To English In String

Jaeger

I'm getting the time in my device, It's returning the time in GMT, and i'm converting it to Local .

The time i'm getting is for example : 23:00, When switching to Locale it returns in Arabic numbers, When i take the time from JSON, it doesn't switch it to Arabic .

Code :

    private String GMTToLocal(String InputText){
    SimpleDateFormat inputFormat = new SimpleDateFormat
            ("yyyy:M:dd kk:mm", Locale.US);
    inputFormat.setTimeZone(TimeZone.getTimeZone("GMT"));

    SimpleDateFormat outputFormat =
            new SimpleDateFormat("kk:mm");
    // Adjust locale and zone appropriately
    Date date = null;
    try {
        date = inputFormat.parse(InputText);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return outputFormat.format(date);
}

I tried the following, but didn't work :

String Tes2 = String.format(Locale.ENGLISH,Arabic_Letters_String);

The problem in short, i need the time in English letters/numbers, not in Arabic, this only happens when i get the time from my device, but if i get it from JSON, it takes it as English and return it as English, but from the device, it takes it as Arabic and return it as 0 value ( because Simpledateformat takes English only i guess ) .

tynn

SimpleDataFormat has a constructor accepting a Locale. By default the device locale is used, thus giving you arabic numbers.

SimpleDateFormat outputFormat = new SimpleDateFormat("kk:mm", Locale.US);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Convert English numbers in a String to Arabic numbers

From Dev

Convert English numbers in a String to Arabic numbers

From Dev

How to convert english numbers inside a string to Persian/Arabic numbers in Objective-C?

From Dev

UITextview shows text Arabic but numbers English

From Dev

Want to match all non numbers is Arabic and English

From Dev

Convert Arabic String to english number in Swift

From Java

How to convert Persian/Arabic numbers to English numbers in Kotlin?

From Dev

Convert English numbers to Persian/Arabic only for a specified div

From Dev

How use arabic letters with english letters and numbers in regular expression

From Dev

Regular expression for Arabic, and English Numbers, with country code as well

From Dev

How to load arabic string.xml when device language is English

From Dev

Words shuffle when Arabic and English words are in a same string

From Dev

How to remove english text from arabic string in python?

From Dev

How to map a arabic character to english string using python

From Dev

How to convert Persian and Arabic digits of a string to English using JavaScript?

From Dev

Switch numbers in string

From Dev

English to Arabic conversion in wordpress

From Dev

Convert numbers in string to English word format

From Dev

Use arabic letters with arabic numbers

From Dev

android select language (Arabic in Arabic, English in English, French in French)

From Dev

Arabic Date To English‎ date conversion

From Dev

Arabic and English text in PostgreSQL database

From Dev

Validating Arabic and English input field

From Dev

Arabic Date To English‎ date conversion

From Dev

Arabic and English text in PostgreSQL database

From Dev

WPML makes my website 3 times slower when switch the language from default (English) to other (e.g. Arabic)

From Dev

I've a problem while configuring Ubuntu 18.04 to switch between Arabic and English using Alt-R + Shift-R

From Dev

MySQL Table Column has English values or Arabic

From Dev

How to convert english date to arabic date in .Net

Related Related

  1. 1

    Convert English numbers in a String to Arabic numbers

  2. 2

    Convert English numbers in a String to Arabic numbers

  3. 3

    How to convert english numbers inside a string to Persian/Arabic numbers in Objective-C?

  4. 4

    UITextview shows text Arabic but numbers English

  5. 5

    Want to match all non numbers is Arabic and English

  6. 6

    Convert Arabic String to english number in Swift

  7. 7

    How to convert Persian/Arabic numbers to English numbers in Kotlin?

  8. 8

    Convert English numbers to Persian/Arabic only for a specified div

  9. 9

    How use arabic letters with english letters and numbers in regular expression

  10. 10

    Regular expression for Arabic, and English Numbers, with country code as well

  11. 11

    How to load arabic string.xml when device language is English

  12. 12

    Words shuffle when Arabic and English words are in a same string

  13. 13

    How to remove english text from arabic string in python?

  14. 14

    How to map a arabic character to english string using python

  15. 15

    How to convert Persian and Arabic digits of a string to English using JavaScript?

  16. 16

    Switch numbers in string

  17. 17

    English to Arabic conversion in wordpress

  18. 18

    Convert numbers in string to English word format

  19. 19

    Use arabic letters with arabic numbers

  20. 20

    android select language (Arabic in Arabic, English in English, French in French)

  21. 21

    Arabic Date To English‎ date conversion

  22. 22

    Arabic and English text in PostgreSQL database

  23. 23

    Validating Arabic and English input field

  24. 24

    Arabic Date To English‎ date conversion

  25. 25

    Arabic and English text in PostgreSQL database

  26. 26

    WPML makes my website 3 times slower when switch the language from default (English) to other (e.g. Arabic)

  27. 27

    I've a problem while configuring Ubuntu 18.04 to switch between Arabic and English using Alt-R + Shift-R

  28. 28

    MySQL Table Column has English values or Arabic

  29. 29

    How to convert english date to arabic date in .Net

HotTag

Archive