![]() |
#1 |
Участник
|
palleagermark: Increment dates by months in X++
Источник: http://www.agermark.com/2015/05/incr...nths-in-x.html
============== A question was asked in the forums, about how to increment dates by months like: 21/02/2015 21/03/2015 21/04/2015 etc. nextMth and dateMthFwd was suggested, so I just wanted to list some options. Consider these examples. nextMth will be off by days after hitting uneven months: static void TestNextMth(Args _args) { date d = nextMth(31\12\2015); print d; d = nextMth(d); print d; d = nextMth(d); print d; d = nextMth(d); print d; pause; }
static void TestDateMthFwd(Args _args) { date d = mkDate(31, 12, 2015); print dateMthFwd(d, 1); print dateMthFwd(d, 2); print dateMthFwd(d, 3); print dateMthFwd(d, 4); pause; }
static void TestAddMonths(Args _args) { System.DateTime dateTime = new System.DateTime(2015, 12, 31); print dateTime.AddMonths(1); print dateTime.AddMonths(2); print dateTime.AddMonths(3); print dateTime.AddMonths(4); pause; }
Источник: http://www.agermark.com/2015/05/incr...nths-in-x.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|