• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

C BSFN Add 15 Days to Date in C

coolkl

Active Member
Hello All,

I am aware of basic C for JDE, so asking following question. I want to add 15 days to a variable in C. I am trying to use MathAdd as "MathAdd(&lpDS->jdAgingDate, &lpDS->jdAgingDate, 15); but it gives
warning C4133: 'function' : incompatible types - from 'JDEDATE *' to 'MATH_NUMERIC

Any alternative C code API or function to use. Thanks for help.

Thanks & Best Regards,
CKL.
 

JMR

VIP Member
Look for examples of the api: AdvanceDate().

Sorry don't have the api guide or an E1 client handy to give you any details.
 

craig_welton

Legendary Poster
Just to give more info about the API Jeremy correctly listed:

short AdvanceDate (JDEDATE* lpjdTarget, JDEDATE* lpjdSource, long lMonthAdvance, long lDayAdvance);

lpjdsource = pointer to JDEDATE before the adjustment
lpjdTarget = pointer to JDEDATE after the adjustment
lMonthAdvance = number of months to adjust by
lDaysAdvance = number of days to adjust by

So to take todays date and add 15 days ...

Code:
JDEDATE    jdToday = {0};
JDEDATE    jdAdjusted = {0};

JDEDATEToday(&jdToday);
AdvanceDate(&jdAdjusted, &jdToday, 0, 15);
 

coolkl

Active Member
Thanks very much JMR and Criag. Craig thanks for the detail code. I used the BSFN and C code compiled perfectly. I am now testing the logic. Thanks.
 

coolkl

Active Member
Hello All,

I am stuck at one point. AdvanceDate API works when I pass digit. But no of days are in Alpha field which I want to convert to Numeric (int). I converted to MathNumeric (wiht help from another question I asked on jdelist), but need to figure out how to convert String to int.

Appreciate any help.
 

coolkl

Active Member
Thanks everyone. Yes I found MathNumericToInt & jdeAtoi in B4200310 and used it. It works great.
 
Top