笔记(加强AX对月份操作)
AX 针对日期的操作函数有限,没有像.net那么强大.所以有时候我们还得借助.net.例如对月份的操作
//by kim 20130609 //parm 1 orginal Date //parm 2 add or decrease mth //parm 3 flag add or decrease if true indicate add otherwise decrease static date AddOrDecreaseMth(date _originalDate, int _mth, boolean _direction = true) { System.DateTime dt; date transferDate; str strDate; ; dt = new System.DateTime(year (_originalDate), mthOfYr (_originalDate), dayOfMth(_originalDate)); if(_direction) { dt = dt.AddMonths(real2int(abs(_mth))); } else { dt = dt.AddMonths(-real2int(abs(_mth))); } strDate = dt.ToShortDateString(); transferDate = str2Date(strDate,321); if(transferDate != dateNull()) return transferDate; return dateNull(); }