How to get DateNull in axapta x ++

One of my co new bie developer with the Dot net background had really hard time in figuring out the dateNull in x++ due to two reasons
  1. X++ does not have intellisense like Dot net which could help the newbie like my colleague
  2. The null value in  x++ debugger is shown as “Zero (0)”. So lots of new bie take the null value for date time as 0 and go in wrong direction
So i just thought to do a simple post on it. I know for a senior or the developer at mid level may find this simple and irrelevant to be posted at the blog, however i think this may help the new developer who are at the edge of starting new career in x++.
So here it goes
DateNull for the date can be checked by two ways
  1. Globals::DateNull()
  2. or like this
    if (endDate != mkdate(1,1,1900)
The minimum value for the date in x++ is 1/1/1900 and max value is 12/31/2154

If you have utcDateTime here is how you can set dateNull and maximum value
todayDate = DateTimeUtil::minValue();
maximumDate =  DateTimeUtil::maxValue();
blankUtcDate = utcDateTimeNull();
Hope this help

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.