Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i add the st,nd,rd or th at the end of a date month?

Asked by 3 years ago

so when using os.date I want it to print something like this : --> August 25th the code I am using right now is :

print(os.date("%B %d", os.time()))

the problem with this is that it prints August 25 and not August 25th anybody know how to get the "st", "nd", "rd", or "th" at the end of a month date

1 answer

Log in to vote
0
Answered by 3 years ago
print(os.date("%B %d", os.time())..'th')

lmao? Just concatenation needed ".." followed by "th", you can use string.sub to get the numbers and check whether to put st nd rd or th

Ad

Answer this question