0

I am trying to convert an Arabic Time to Englist Time can anyone help me on this.

Example :- The Arabic Time is 12:30 صباحاً

The English Time should be 12.30 AM

  • 1
    Can you read this link :- http://stackoverflow.com/questions/19923498/java-date-time-in-arabic – AnilCk Mar 15 '17 at 10:27
  • 3
    Possible duplicate of [Java date time in arabic](http://stackoverflow.com/questions/19923498/java-date-time-in-arabic) – Anton Balaniuc Mar 15 '17 at 10:29

1 Answers1

0

You may use a DateFormat with an arabic Locale to parse the original String to a Date, then a DateFormat with Locale.ENGLISH to convert to an english String :

DateFormat formatArabic = new SimpleDateFormat("hh:mm aa", new Locale("ar", "SA"));
DateFormat formatEnglish = new SimpleDateFormat("hh:mm aa", Locale.ENGLISH);

try {

    Date date = formatArabic.parse("12:30 صباحاً");

    System.out.println(formatEnglish.format(date));

} catch (ParseException e) {

    e.printStackTrace();
}
Arnaud
  • 17,229
  • 3
  • 31
  • 44