Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display date in arabic in this format 'Wednesday, May 22, 2013'

Tags:

date

c#

I have a multilingual website and I need to show the date in this format Wednesday, May 22, 2013. I use following line of code to display dates

DateTime.UtcNow.ToString("D");

That doesn't work when I use this along with Culture info

It then shows me dates in this format مايو 2013,22

How can I show date in arabic in format year, date month day

I am not sure why DateTime.UtcNow.ToString("D"); is not able to convert to arabic date with weekdays

UPDATE : this works DateTime.Now.ToString("dd dddd , MMMM, yyyy", new CultureInfo("ar-AE"))

like image 333
Learning Avatar asked May 22 '13 07:05

Learning


1 Answers

You can specify the format explicitly:

DateTime.UtcNow.ToString("dddd, MMMM dd, yyyy");

This will output, for example:

Wednesday, May 22, 2013

A lowercase 'd' stands for the day, two 'd's for the day with a zero in front if applicable, three 'd's for the abbreviation of the name of the day and four 'd's for the complete name of the day. The same applies to the months with a capital 'M' (lowercase 'm' are minutes!).

like image 124
John Willemse Avatar answered Nov 15 '22 18:11

John Willemse