[Resource] Previous Date Number Box (Yesterday, Today and Tomorrow's Date)

Hello!
Long story sort, I wanted my watch face to not only show the current date, but also the previous and next date numbers to the left and right respectively (I can’t remember the real watch I saw this on, but I thought it was genius [if anyone knows the brand/model, I’d love to see it, I can’t find it again :frowning:]), because I don’t know about other people, but I can never remember how many days the current month has… I’m a bit ashamed to admit it but there you go, some things simply do not stick in my memory :stuck_out_tongue:

With that said, here is the code I use in all 3 boxes (previous date, current date, next date respectively):
Prev. Date:
$#DM#==1&&(#Dd#-1)<1?31:$$#DM#==2&&(#Dd#-1)<1?31:$$#DM#==3&&#Dd#==1&&#DD#==61?29:$$#DM#==3&&(#Dd#-1)<1?28:$$#DM#==4&&(#Dd#-1)<1?31:$$#DM#==5&&(#Dd#-1)<1?30:$$#DM#==6&&(#Dd#-1)<1?31:$$#DM#==7&&(#Dd#-1)<1?30:$$#DM#==8&&(#Dd#-1)<1?31:$$#DM#==9&&(#Dd#-1)<1?31:$$#DM#==10&&(#Dd#-1)<1?30:$$#DM#==11&&(#Dd#-1)<1?31:$$#DM#==12&&(#Dd#-1)<1?30:(#Dd#-1)$

Current Date:
#Dd#

Next Date:
$(#Dd#+1)>#DIM#?1:(#Dd#+1)$

Obviously the big chunk of work cut out for people will be the Prev. Date expression :stuck_out_tongue: it’s nothing fancy and not really complicated, but it’s meant to cut down on some grunt work.
Note the expression also accommodates the month of February both in and out of Leap Year (this 2020 for example [leap year], on the 1st day of March, the 3 date boxes will read: 29 - 1 - 2)

There might be a simpler way to do all of this, and if there is, by all means if anyone would like to share, it’d be much appreciated :slight_smile: Otherwise… this unfancy mess works just fine :stuck_out_tongue:

For anyone interested in how the expression works, and might not know, it’s simply:
If the current month is X (January, February, March, etc in number form where January is 1, and December is 12), and the current date - 1 is below 1, then show last month’s maximum known date. Repeat for all the months of the year :stuck_out_tongue:
For February it’s looking at 2 conditions; the first one checks if the current month is March and the current date is 1 and the current Day of the Year is 61; if all of this is true, then it’s a leap year, and the number here should be 29. Otherwise, if the current month is March and the current date - 1 is below 1 (as with every other month), then 28.
Then at the very end of the expression (and what takes over in any other date not covered above), it’s simply Current Date - 1.

kMhs7NT

QuLYtP9
Gif Demo February 27th, 2020 (leap year) through March 2nd.

Sadly I can’t post the watch face I’m using this on, as it’s meant to be a tribute to a watch I simply can’t afford and I recreated the face for private use (along with all the extra features I wanted on it) :stuck_out_tongue:

Enjoy!

2 Likes

Your code works beautifully! The only issue I see is the current date reads 01-09 but the previous and next dates only read 1-9 without the leading zero.
Capture
I tried altering all your tags to #DdL# instead of #Dd# but couldn’t force it to work in the editor. My solution will be to add Opacity tags and treat it like I do adding leading zeros to my digital time displays. Here are the opacity expressions I came up with.

Opacity filters
Zero Last Date with added 0 in text box
$(#Dd#-1)<10?100:0$

Last Date (no zero)
$(#Dd#-1)>=10?100:0$

Zero Next Date with added 0 in text box
$(#Dd#+1)<10?100:0$

Next Date (no zero)
$(#DdL#+1)>=10?100:0$

Capture2
Just in case you are as OCD as I am. :grin:

1 Like

I don’t understand, the tag I used I picked specifically because it has no leading zero. I suppose you could remove the zero from the normal date somehow. Not at home currently or I’d look into it, I am in fact very ocd lol, so either way thanks!

So where exactly do you find that the date reads with a leading zero? As I said the tag I used, I used specifically because it wouldn’t have a leading zero, and both on my watch (Active 2), the preview simulation, and indeed the creator itself show the number just fine (no leading zero either):

Not sure where you’re seeing this?

Edit: Also, another silly thing you can do with the #DdL# tag (this is the one that shows the leading zero) is (#DdL#-0), this just like any other math equation on these tags gets rid of the leading zero. You could try that I suppose!

I normally use the leading zero date and when I tried to force your code to match it, the editor refused to work like that. I guess I didn’t make myself clear when I replied to your first post. I have a habit of my fingers getting ahead of my brain when typing. (I’ll blame my typing teacher in school for that, always trying to make us type faster without thinking about it.) :grinning: The point I was trying to make was that your code would not work with the leading zero style of date even when changing all the #Dd# tags to #DdL# tags. Which would make your next date expression $(#DdL#+1)>#DIM#?1:(#DdL#+1)$ which won’t display a leading zero for some reason. I’m sorry if I didn’t make myself more clear the first time.

OH Sorry, so you wanted a leading zero xD Yeah for some reason math equations on tags with leading zeros just… get rid of the leading zeros lol, I don’t know why, but there doesn’t seem to be a very clean way around it other than, yeah, something like what you did xD

1 Like

Caution: @Facer_Official should known better, but the nested conditionals with inside boolean doesn´t work for all the system and watches. So, sadly, you have to separate that beautiful formula in several layers and use transparency or position to show/hide…

@carlosfilippa – My understanding is it works for all systems as long as its used in certain fields; text field for example should be okay… but I suppose time will tell :stuck_out_tongue:

It is amazing ,thanks, it help me a lot.

2 Likes

You’re welcome :v:

I loved this. I actually had a watch a long time ago that had the days on a disc that rotated and it showed 2 days either side of this date.

With regard to your logic I think it could be simplified. How about something like:

If Today > 1 then Today-1; else if month = (1 or 2 or 4 or 6 or 8 or 9 or 11) then 31; else if month = 3 then (your brilliant 28th vs 29th calculation); else 30
Wouldn’t that work?

1 Like

Thanks!

Maybe! Not sure how much simpler that would be. Give it a go and report back :stuck_out_tongue:

I got as far as this:
$#Dd#>1?(#Dd#-1):$$#DM#=1||#DM#=2||#DM#=4||#DM#=6||#DM#=8||#DM#=9||#DM#=11?31:$$##DM=3&&#DD#=61?29:##DM=3?28:30$

which didn’t work.

And then found there was an existing thread on it, which shows something close:

Their string for Day-1 is:
$#Dd#!=1?(#Dd#-1):$#DM#=2&&#DD#=60?28:$#DM#=2&&#DD#=61?29:$(#DM#=4||#DM#=6||#DM#=9||#DM#=11)&&#Dd#=1?30:$(#DM#=1||#DM#=3||#DM#=5||#DM#=7||#DM#=8||#DM#=10||#DM#=12)&&#Dd#=1?31:$

I’ll have to review to see where I went wrong.

I think I was pretty close, but I have to work on it.

Nice, I missed that thread o/

There are so many of them!

You know, looking further into their formula it looks like there are a number of issues. I wouldn’t update yours just yet…

:+1:t2: