I am not sure if it is something with xslt or xpath..but how do I increment a date by 1 day? For example, if the date is 2/16/2009 I want the date to be incremented by 1 to become 2/17/2009 etc. etc.
Asked
Active
Viewed 1.3k times
8
-
3Care to give an example of what you want to accomplish? – Lasse V. Karlsen May 22 '09 at 16:38
-
increment a date by one what? second, minute, hour, day? – x0n May 22 '09 at 16:39
2 Answers
12
Incrementing a date variable in X++, Dynamics AX:
static void IncDate(Args _args)
{
TransDate transDate = 16\02\2009;
;
transDate++;
print transDate;
pause;
}
Result: 17/02/2009

10p
- 5,488
- 22
- 30
-
This seems like a very poor way to do it. Are you adding Days, Months, Years? Maybe minutes or seconds? The second answer here is much better. – B-Rad Aug 13 '14 at 22:56
-
4A) Dates in AX are nothing else but the number of days passed from 01/01/1900. B) You cannot add minutes or seconds to date-typed variables. C) The question was clearly about incrementing by days. D) If you like the other answer feel free to upvote it, just bear in mind that it is about incrementing utcDateTime and not about incrementing a date, thus it's answering a different question. Useful to know anyway. – 10p Aug 13 '14 at 23:59
4
DateTimeUtil::addDays
http://msdn.microsoft.com/en-US/library/cc552939(v=AX.50).aspx (AX 2009)
http://msdn.microsoft.com/en-us/library/datetimeutil.adddays.aspx (AX 2012)

Günter Zöchbauer
- 623,577
- 216
- 2,003
- 1,567
-
Note that this will add days to a utcdatetime type variable, but not to a date type variable. It is still useful, but does not answer the question of simply incrementing a date as the other answer does. – morgb Dec 27 '22 at 21:20