bildwelt
E2E FORUM
E2E Bridge E2E Commerce

Reply To: Determining number of days in month for date difference

E2E Forum Modeling & Development Determining number of days in month for date difference Reply To: Determining number of days in month for date difference

#1827

Alfred
Moderator

Another solution is to use the %j of printDateTimeExpression() which returns the day of the year as decimal number [001,366].

local fromDate = convertToDateTime("2014-02-01");
local toDate = convertToDateTime("2014-03-01");
local fromDateDayOfTheYear = fromDate.printDateTimeExpression("%j");
local fromDateDayOfTheYearNumber = fromDateDayOfTheYear.parseIntegerExpression("009");
local toDateDayOfTheYear = toDate.printDateTimeExpression("%j");
local toDateDayOfTheYearNumber = toDateDayOfTheYear.parseIntegerExpression("009");
local daysOfMonth = toDateDayOfTheYearNumber - fromDateDayOfTheYearNumber;

In the example above daysOfMonth is 28.