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 = new Date(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
- go to chrome open a tab
- press fn + f12, (windows) not sure about mac
- 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"