Help: {ddz} yesterday and tomorrow

i would need the day of month {ddz} befor and after.

today is 16 … i would need yesterday and tomorrow => 15 and 17

anyone an idea how to handle that?

Yesterday (considers leap year and previous month when today is 1 - test with date st Mar 2028 for next leap year)

{dd} > 1 and {dd} - 1 or ({dn} - 1) == 2 and ({dyy} % 4 == 0 and 29 or 28) or ({dn} - 1) == 4 and 30 or ({dn} - 1) == 6 and 30 or ({dn} - 1) == 9 and 30 or ({dn} - 1) == 11 and 30 or 31

Tomorrow

{dd} < {ddim} and {dd} + 1 or 1

If yesterday can be simplified, please post revision

see attached image. (1+{ddz}) yields the day after and (-1+{ddz}) yields the day before.

If you set preview day to 1st of month, that formula will return “0”.

Never ever this will work. Subtract 1 from 31 march and maybe it’s leap year…

I tried lua, but it doesn’t work on every watch… In Studio it shows correct value but not on watch. That’s why i asked.

=>

Yesterday:

tonumber(os.date(“%d”, os.time() - 86400))

Tomorrow:

tonumber(os.date(“%d”, os.time() + 86400))

works fine on samsung watch

My solution works on Samsung?

Great!