The Question already exists in stackoverflow, but it didn't solve my problem. The function getDate calculate number of days based on 3 parameters.
But I always get this error: value too great for base (error token is "09")
line 7 val= ..
function getDate (){
d=$1
m=$2
y=$3
m=$(((m+9) % 12))
y=$((y - m/10))
val=$((365*y + y/4 - y/100 + y/400 + (m*306 + 5)/10 + ( d - 1 )))
return $val
}