Conditions for Date Confusion

Discussion, questions and support.
Post Reply
TypyTypeman
Posts: 6
Joined: Feb 17th, ’23, 05:27

Post by TypyTypeman » Feb 17th, ’23, 05:30

Hello!

I'm trying to create conditions that change the suffix for certain dates, i.e 2nd, 3rd, 4th day.

I can get it to work with one date, like if I do A_DD>3 and then put "th" after it in the text. But then it'll end up putting "th" behind dates that should have "rd" or "nd". How do I do this??


Thanks!
User avatar
Marko
Posts: 1719
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Feb 18th, ’23, 10:32

This script outputs the day of the month in the desired format. Type: Command.

Code: Select all

FormatTime, D,, d
Special := {1: "st", 2: "nd", 3: "rd", 21: "st", 22: "nd", 23: "rd", 31: "st"}
Send, % D . ((S := Special[D]) ? S : "th")
TypyTypeman
Posts: 6
Joined: Feb 17th, ’23, 05:27

Post by TypyTypeman » Feb 19th, ’23, 05:23

Thanks so much! This was such a headache.
TypyTypeman
Posts: 6
Joined: Feb 17th, ’23, 05:27

Post by TypyTypeman » Feb 19th, ’23, 05:25

Marko wrote: Feb 18th, ’23, 10:32 This script outputs the day of the month in the desired format. Type: Command.

Code: Select all

FormatTime, D,, d
Special := {1: "st", 2: "nd", 3: "rd", 21: "st", 22: "nd", 23: "rd", 31: "st"}
Send, % D . ((S := Special[D]) ? S : "th")
Do I put this right after the %A_DD% part or somewhere else?
User avatar
Marko
Posts: 1719
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Feb 20th, ’23, 17:26

What excactly you want to do?
TypyTypeman
Posts: 6
Joined: Feb 17th, ’23, 05:27

Post by TypyTypeman » Feb 20th, ’23, 19:38

The text that I'm adding this to says:

"...this __ day of January."

I have the month set up to change automatically, and just want the day to add the "th" or "nd" etc.

I added what you gave me in place of the A_DD and it seems to be working. I'll know if it changes to "nd" on the 22nd.
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Feb 21st, ’23, 21:21

The last line could be

Code: Select all

Send, % “…this “ D . ((S := Special[D]) ? S : "th") “ day of “ A_MMMM “.”
TypyTypeman
Posts: 6
Joined: Feb 17th, ’23, 05:27

Post by TypyTypeman » Feb 21st, ’23, 23:03

I got it working, thanks! Now I'm working on trying to get this form to act right
Post Reply