Isolating the Unit value from then date

Hi all.
I’m looking to append the date with it’s suffix -2nd, 3rd, 21st etc - but don’t seem to be able to find out how to isolate the unit value. I was wanting to enter it into an opacity expression.

Anyone know how to do this??

1 Like

I did a search with 1st and this is one of the results .
.

.

2 Likes

Oh wow! That’s a huge expression! I was hoping to have it simpler, but beggars can’t be choosers.
Thanks Russel.

2 Likes

I don’t think the formula has to be so massive . It is only n1 n2 n3 that need a different appending . I think there are other solutions but sometimes the Long Hand is best these days .
You can isolate the Units of the date with

((#Dd#)%10)

So you will only need 4 conditionals .
Ist 2nd 3rd and the other th’s .

If you get stuck get back .

Ha Ha . When you try to shorten the formula you get to see the issues very quickly . Stick with the long hand .

1 Like

Yes, K.I.S.S. is the easiest way, I just like brevity with code. Makes it easier to debug/alter

2 Likes

while that is true, I think the 11th to 13th complicate it, so those 4 conditionals would have to be blend of two conditions each
$floor(#Dd#/10)==1||#Dd#%10>3?th:$
$floor(#Dd#/10)!=1&&(#Dd#%10)==1?st:$
$floor(#Dd#/10)!=1&&(#Dd#%10)==2?nd:$
$floor(#Dd#/10)!=1&&(#Dd#%10)==3?rd:$

2 Likes

Hey . Thank you Peter as always . I lost the thread there . Nice one .
I really don’t mean to Nit Pick at your Formulas .
The way I see it we need just one more line for 20th and 30th.
This is the best I can do .I bet it could be neater .
.
$#Dd#==20||#Dd#==30?th:$

2 Likes

$#Dd#>=4&&#Dd#<=12?#Dd#th:$$#Dd#>=13&&#Dd#<=20?#Dd#th:$$#Dd#>=24&&#Dd#<=30?#Dd#th:$$#Dd#==1?#Dd#st:$$#Dd#==2?#Dd#nd:$$#Dd#==3?#Dd#rd:$$#Dd#==21?#Dd#st:$$#Dd#==22?#Dd#nd:$$#Dd#==23?#Dd#rd:$$#Dd#==31?#Dd#st:$

2 Likes