Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
1.24/5 (3 votes)
Hi Friends,
I want to Convert Hijri(Arabic) Date into English Date Format..

For Ex,Current Hijri Date --> 07-08-1434 (dd-MM-yyyy)

I want to Convert like this--> 16-06-2013 (dd-MM-yyyy)

Thanks in Advance.....
Posted
Updated 7-May-17 23:45pm
Comments
Richard MacCutchan 16-Jun-13 3:26am    
Google: there are lots of code samples for this issue.
MichealRay 16-Jun-13 3:27am    
Thank u for ur Reply.if u know give me one Code Sample..
Richard MacCutchan 16-Jun-13 3:57am    
Go and search Google; try doing your own work.
MichealRay 17-Jun-13 12:23pm    
Richard MacCutchan, iam a fresher and new for C#.Net..thats y am asking questions in CodeProject..if u dont know this concept just shut up ur mouth and leave my post...Dont Waste my time...

Instead of solving this (simple) problem, review the wider design of your code and try to understand: isn't it because you are trying to work with strings representing data instead of data itself. This is a very usual fallacy of beginners' work these days. Look at it this way: the notion of the time and the calendar are universal, not depending on culture.

If you use databases, you can store data in date type, which does not depend on culture, but you can get a string value representing time in the format you want, which is defined by the query. In .NET code, you are using the types like System.DateTime and System.TimeSpan which also don't depend on culture. You need to specify culture (or simply use default culture which is defined by the culture and UI culture of your UI thread) when you show date/time on UI.

Therefore, there is no a problem of "converting" of date/time between cultures, there is a problem of storage (don't use anything culture-specific), and the problem of output to UI. Please see all of the methods System.DateTime.ToString and formatting:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^],
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^],
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^].

—SA
 
Share this answer
 
Have a look here:
Working with Calendars

It explains quite well how you can use Calendar derived classes (including HijriCalendar Class (System.Globalization)[^] ) to convert DateTime between different calendars/cultures.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900