Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert english date to arabic date in .Net

Tags:

c#

asp.net

Hi i am looking for method to transform English date in this format dd/MMM/yyyy to Arabic date

for example 18/Feb/2016 will be in Arabic ١٨/فبراير/٢٠١٦

like image 602
Ayman Avatar asked Feb 18 '16 16:02

Ayman


People also ask

How do you write dates in Arabic format?

Short dates are written in "Day/month/year" from; when writing in Arabic and English: For Gregorian calendar: ١٦/١٢/٢٠١٣ميلادي or 16/12/2013.

How do you convert strings from mm/dd/yyyy to date?

string strDate = DateTime. Now. ToString("MM/dd/yyyy");


2 Answers

Try using something like this:

DateTime.Now.ToString("dd dddd , MMMM, yyyy", new CultureInfo("ar-AE"));

instead of the DateTime.Now just put whatever DateTime object you want to convert.

like image 129
Varda Elentári Avatar answered Oct 20 '22 12:10

Varda Elentári


Use CultureInfo class to convert date formats in different languages.

using System.Globalization;    
DateTime.UtcNow.ToString("dd dddd , MMMM, yyyy", new CultureInfo("ar-AE"));
like image 39
Codemaker Avatar answered Oct 20 '22 14:10

Codemaker