Does anyone know of an expression that gives days in the previous month? I use to use an array to account for leap year and non leap year. But since we can’t use scripting….
Thanks in advance.
Does anyone know of an expression that gives days in the previous month? I use to use an array to account for leap year and non leap year. But since we can’t use scripting….
Thanks in advance.
this should work (including leap year solution)
({dn} == 3 ? (28 + {ly}) : ({dn} == 5 || {dn} == 7 || {dn} == 10 || {dn} == 12 ? 30 : ({dn} == 1 ? 31 : ({dn} == 2 ? 31 : ({dn} == 4 ? 31 : ({dn} == 6 ? 30 : ({dn} == 8 ? 31 : ({dn} == 9 ? 30 : 31))))))))
or this is even more simple =>
({dn} == 1 ? 31 : ({dn} == 3 ? (28 + {ly}) : ({dn} == 5 || {dn} == 7 || {dn} == 10 || {dn} == 12 ? 30 : 31)))
Thank you! I’ll give it a try when I get a chance.
looks great - thanks for update
Ok after bashing my way through this I finally figured everything out. Changing back to Lua helped. Since I kept forgetting that I could do “and” “and” “or”.
{dd} == {ddim} and {dn} == 5 and 30 or {dd} == {ddim} and {dn} == 7 and 30 or {dd} == {ddim} and {dn} == 10 and 30 or {dd} == {ddim} and {dn} == 12 and 30 or {dd} == {ddim} and {dn} == 1 and 31 or {dd} == {ddim} and {dn} == 2 and 31 or {dd} == {ddim} and {dn} == 4 and 31 or {dd} == {ddim} and {dn} == 6 and 31 or {dd} == {ddim} and {dn} == 8 and 31 or {dd} == {ddim} and {dn} == 9 and 31 or {dd} == {ddim} and {dn} == 11 and 31 or {dd} == {ddim} and {dn} == 3 and {dy}%4==0 and 29 or {dd} == {ddim} and {dn} == 3 and 28 or {dd} == 1 and 1 or {dd}-1