CosmoIV
1
I’m trying display the current calendar week.
The problem comes in when I try to display the previous month’s dates.
I use this formula to get the date for Sunday, changing the 1 to the whatever day of the week gives the correct result within the month.
(#Dd#-(#DOWB#-1))
Outside the month shows negative numbers and above 31.
I’ve tried this but it doesn’t display anything. I don’t know if conditionals work this way.
$(#Dd#-(#DOWB#-1))<=1?(#Dd#-(#DOWB#-1)):$$#DM#=2||#DM#=4||#DM#=6||#DM#=9||#DM#=11||#DM#=1?(31-(#DOWB#-1):$$#DM#=5||#DM#=7||#DM#=10||#DM#=12?(30-(#DOWB#-1):$$#DM#=3?$#DISLEAPYEAR#?(29-(#DOWB#-1)):(28-(#DOWB#-1)):err$
This person had the same problem with no solution.
I’m using this style’s method of getting the date:
but I’m using the following to hide the dates from the previous month.
$(#Dd#-(#DOWB#-1))>0?100:0$
1 Like
Yes, calculations back in time are not easy…
Check this thread, should have what you are looking for.
1 Like
CosmoIV
3
I have it figured out. I had to used two sets of text.
This for the current month and next month’s dates (This is for Sunday, replace the “0” with the number for every day):
$(#Dd#-#DOW#+0)<=#DIM#?(#Dd#-#DOW#+0):((#Dd#-#DOW#+0)-#DIM#)$
This for the contrast:
$(#Dd#-#DOW#+0)>0?100:0$
For the previous month (This is for Sunday, replace the “0” with the number for every day):
($#DM#=1&&(#Dd#-#DOW#+0)<1?31+(#Dd#-#DOW#+0):$#DM#=2&&(#Dd#-#DOW#+0)<1?31+(#Dd#-#DOW#+0):$#DM#=3&&#Dd#=1&&#DD#=60?28+(#Dd#-#DOW#+0):$#DM#=3&&(#Dd#-#DOW#+0)<1?29+(#Dd#-#DOW#+0):$#DM#=4&&(#Dd#-#DOW#+0)<1?31+(#Dd#-#DOW#+0):$#DM#=5&&(#Dd#-#DOW#+0)<1?30+(#Dd#-#DOW#+0):$#DM#=6&&(#Dd#-#DOW#+0)<1?31+(#Dd#-#DOW#+0):$#DM#=7&&(#Dd#-#DOW#+0)<1?30+(#Dd#-#DOW#+0):$#DM#=8&&(#Dd#-#DOW#+0)<1?31+(#Dd#-#DOW#+0):$#DM#=9&&(#Dd#-#DOW#+0)<1?31+(#Dd#-#DOW#+0):$#DM#=10&&(#Dd#-#DOW#+0)<1?30+(#Dd#-#DOW#+0):$#DM#=11&&(#Dd#-#DOW#+0)<1?31+(#Dd#-#DOW#+0):$#DM#=12&&(#Dd#-#DOW#+0)<1?30+(#Dd#-#DOW#+0):00$)
This for the contrast:
$(#Dd#-#DOW#+0)<1?100:0$
I used this post’s code as a base for the previous month’s code.
4 Likes
Zieneth
5
Thank you for the tag! I’m definitely looking into this
2 Likes