Microsoft Dynamics AX Thoughts
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++
By doing this, you will have a drop down list in the User Options shown in the General tab like the following:
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:
-
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.
-
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:
This is the result:
6 Comments to “Hijri date in Dynamics AX”
Post comment
Search the site
Dynamics AX 2012 Event
Recent Posts
- Enterprise Portal is Not Working on Dynamics AX 2012 Hyper-V Image
- Dynamics Academy – An Academic Project for Microsoft Dynamics in Saudi Arabia
- Microsoft Dynamics AX 2012 Event in Khubar
- Knowledge Bridge
- Columbus IT
- Fawzi Al-Nahdi and Partners Holding Group
- Dynamics AX 2009 Shows One Line Only in Its Grids
- Talal Abu-Ghazaleh
Tags
Archives
- December 2011 (2)
- November 2011 (3)
- July 2011 (2)
- June 2011 (4)
- May 2011 (3)
- April 2011 (4)
- March 2011 (12)
- February 2011 (2)
- January 2011 (3)
- December 2010 (1)
- November 2010 (1)
- October 2010 (5)
- August 2010 (1)
- July 2010 (3)
- June 2010 (4)
- May 2010 (5)
- April 2010 (1)
- March 2010 (9)
- February 2010 (4)
- January 2010 (4)
- December 2009 (11)
- September 2009 (1)
- August 2009 (1)
- July 2009 (2)
- September 2008 (1)
Random Testimonial
- ~ Ziad Yehia, ERP Business Consultant at NetWays
"I have one thing to say about Amer,
When you have a tough Dynamics AX question that you are not able to answer; he is the person to call..." - Read more testimonials »
What's the little bird saying?
- Get a weekly doze of technology with the Microsoft Mondays Webcasts http://t.co/wyQSlYH3. This month showcases SSDT, Azure and SharePoint. 2 weeks ago
- @fawad343 Why not :)... I spent my honeymoon there.. and I would love to get back to it again! :D 3 weeks ago
- @saadalahmed تعليق بسيط... لاشيئ في العالم يسمى اسرائيل... لعلك تعني المغتصبة فلسطين؟ 3 weeks ago
- More updates...
Posting tweet...
Powered by Twitter Tools

December 22, 2009 in 


January 18, 2010 at 12:56 pm
Hi,
Thanks a lot for the post, really helpful…
but for the class to be created, how can the SQL command be written in AX Code?
Thanks
January 18, 2010 at 11:22 pm
Hi!
Try this code. This function basically takes a “normal” date as a parameter and returns the converted Hijri date as a string.
server static str convertDateToStr(date strDate)
{
DictTable _dictTable;
Connection _connection;
Statement _statement;
str _sql,strResultDate;
ResultSet _resultSet;
Enumerator enum, enum2;
SqlStatementExecutePermission _perm;
Str _tempStr;
;
_tempStr = int2str(mthofyr(strDate)) + “-” + int2str(dayofmth(strDate)) + “-” + int2str(year(strDate));
_Sql= “select convert(varchar,convert(datetime,’” + _tempStr + “‘,102), 131)” ;
_connection = new Connection();
_perm = new SqlStatementExecutePermission(_sql);
// Check for permission to use the _statement.
_perm.assert();
_statement = _connection.createStatement();
_resultSet = _statement.executeQuery(_sql);
// End the scope of the assert call.
CodeAccessPermission::revertAssert();
_resultSet.next();
strResultDate = _resultSet.getString(1);
strResultDate = strLrTrim(strResultDate);
enum = strSplit(strResultDate,” “).getEnumerator();
if(enum.moveNext())
strResultDate = enum.current( );
enum2 = strsplit(strResultDate, “/”).getEnumerator();
if(enum2.moveNext())
{
if(any2int(enum2.current()) < 10)
strResultDate = “0″ + strResultDate;
}
return strResultDate;
}
May 15, 2010 at 11:38 pm
[...] a previous post, I descriped in deatils how to gte (and set) Hijri date in Microsoft Dynamics AX 2009. In that post [...]
October 5, 2010 at 11:50 am
[...] Hijri date in Dynamics AX [...]
February 20, 2011 at 10:37 am
thanks for your great posts
Where we should write this edit method?
February 20, 2011 at 12:45 pm
HI Mb:),
In the form you want this field to be displayed in.