Skip to content Skip to sidebar Skip to footer

English Date To Arabic Text Using Javascript

I want to convert from English Date to Arabic Text using javascript Let's say if i give 22/08/2019 then it needs to be converted to Arabic Text format( Like in english it's twenty

Solution 1:

strange this only works on a browser. run the snippet below or follow the instructions below you'll be fine.

var event = newDate(Date.UTC(2012, 11, 20, 3, 0, 0));
var options = {
  weekday: 'long',
  year: 'numeric',
  month: 'long',
  day: 'numeric'
};

console.log(event.toLocaleDateString('ar-EG', options));

this should work although this will work on your browser

  1. go to chrome open a tab
  2. press fn + f12, (windows) not sure about mac
  3. go to console

paste the above code line by line, press enter. you should get the output below

// expected output: الخميس، ٢٠ ديسمبر، ٢٠١٢

Post a Comment for "English Date To Arabic Text Using Javascript"