I have an updated field in the format mm.dd.yyyy and I have the currentDate() in sil and I need to use these two to find the number of dates between updated date an dcurrent date. But I get Unexpected error executing rule:Exception while executing SIL program >>baseline.sil<<: [SIL Error on line: 57, column: 18] Casting to INTERVAL not supported.
my code is:
date date1=parseDate("MM.dd.yyyy",updated1);
date date2=parseDate("MM.dd.yyyy ,currentDate());
number difference=date2-date1;
Hello,
I guess, the only way to write a function, which would return you the number of days from an interval:
function intervalToHours(interval time) {
string [] t = split(trim(time), " ");
int hours = 0;
number days = 0;
number minutes = 0;
int hoursDay = getWorkingHoursPerDay();
for(int x = 0; x < size(t); x++) {
int intTemp;
number numTemp;
if(contains(t[x], "w")) {
intTemp = replace(t[x], "w", "");
intTemp = intTemp * (24 * 7);
hours += intTemp;
}
if(contains(t[x], "d")) {
numTemp = replace(t[x], "d", "");
days += numTemp;
}
if(contains(t[x], "h")) {
intTemp = replace(t[x], "h", "");
hours += intTemp;
}
if(contains(t[x], "m")) {
numTemp = replace(t[x], "m", "");
minutes += numTemp;
}
}
hours += days * 24;
hours += minutes/60;
return hours;
}
You can divide this number of hours by the number of hours in a day and you will get the number of days
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.