Blog

Microsoft Dynamics AX Blog

7

Hijri date in Dynamics AX

In Microsoft Dynamics AX 2009, Hirji calendar (the Islamic calendar) is not yet supported although Hirji date is there in the background of Dynamics AX 2009!

To enable the Hirji Calendar, you should modify some X++ code in the User Options form. To do so, go to: SysUserSetup –> Methods –> run and change the following blue code into the red:

Enabeling Hijri Calendar in User Options form in X++

Enabeling Hijri Calendar in User Options form in X++

  

  By doing this, you will have a drop down list in the User Options shown in the General tab like the following:

Hijri date in User Options form

With this options, you could clearly understand that Microsoft is putting something to enable the Hijri calendar. I have done some testing over this options. It looks that they’re using a middleware to convert the “actual” Gregorian date that is in the database so the user see the data in Hijri format. Unfortunately, I couldn’t complete the testing with successful results… it started to get me weird results. That’s why Microsoft is not yet supporting it.

  

Till Microsoft supports it, you could use a very easy to use function in the SQL server: convert(datetime,’12-22-2009′,102), 131)  

  

To solve the Hirji date problem, you could create a class with two methods:  

 

  1. One that takes a “date”  and returns a Hirji date after calling this SQL method: select convert(varchar,convert(datetime,’12-22-2009′,102), 131)  –try to run this in SQL Server to see the result. 
  2. Other that takes a Hijri date in an str format, and returns a date by executing this SQL code:  select convert(datetime,’22-01-1417′, 131) –try to run this in SQL Server to see the result

 By this, you could have the ability to show the user a StringEdit control that uses edit moeth to write a Hirji date and you save the result of conversion in the normal Gregorian date, like this:

Edit method to show Hirji date from Gregorian date

This is the result:

Hiji StringEdit control and DateEdit control

Hiji StringEdit control and DateEdit control

 

Dynamics AX 2012 Event

Recent Posts

Tags

Archives

Random Testimonial

  • ~ Ahmad Al-Shanshoury, Senior Dynamics AX Consultant at Al-Fanar IT

    ahmed el shanshoury"I am pleased to be able to write this recommendation for Mr. Amer Atiyah, I was lucky to work with Amer during our implementation of Dynamics AX at AlOthaim company. Since the day one, I know him as an energetic and goal-oriented person Amer demonstrated a strong work ethic and a dedication to success. His efforts have produced high quality results time and time again.His extraordinary ability to analyze problems and outline necessary courses of action was invaluable, simply I can see Amer innovative, creative, intelligent and ambitious, in addition of his powerful Technical background. Seldom have I been able to recommend someone without reservation. It is a pleasure to do so in the case of Amer"

  • Read more testimonials »