It is currently May 28th, 2024, 6:26 pm

Substituting in date help

Get help with creating, editing & fixing problems with skins
xSqrillex
Posts: 2
Joined: October 1st, 2012, 9:34 pm

Substituting in date help

Post by xSqrillex »

Is it possible to add the suffixes onto the end of a date? I am referring to the "th", "rd", "nd" and "st" after the number. I have tried to use substitutes but haven't got very good results.
Here is what I have now, which does not work.
[MeasureDate]
Measure=Time
Format="The current time is %#I:%M %p. Today is %A, %b the %#d."
Substitue="1":"1st"
Also, can I change AM and PM to Morning and Afternoon? What I want is "The current time is x:xx in the afternoon on monday, October the first.
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Substituting in date help

Post by thatsIch »

you have to add the suffixes manually via a substitute
but you have to remember you use unique numbers as 1 isnt unique cause 11 can be substituted to 1st1st instead
therefore most its "01":"1st" or something like that

am/pm:
yes same via substitute if you got the AM/PM information already
Alex Becherer

Re: Substituting in date help

Post by Alex Becherer »

Code: Select all

[MeasureDate]
Measure=Time
Format="The current time is %#I:%M %p. Today is %A, %b the %#d."
Substitute="the 1.":"the 1st.","the 2.":"the 2nd.", .....
not really a big deal, as it is limited to 31 days.
alternatively have a look at RegExpSubstitute.
xSqrillex
Posts: 2
Joined: October 1st, 2012, 9:34 pm

Re: Substituting in date help

Post by xSqrillex »

Thanks for the help! I solved it :) Image