Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can I Add a "th" suffix on a Date's Day Number?

6,651 views
Skip to first unread message

Gary

unread,
Apr 29, 2009, 5:24:15 PM4/29/09
to
I am using the Date Field in a word doc and would like to have the
"th", "rd", "st" or "nd" suffix automatically added on to the day of
the month. i.e. 1st, 2nd, 3rd, 4th... etc.

I don't have any problem getting just the day number, but I can't find
a means of getting the suffix. Also, if there is a way to do this, can
the suffix be super scripted?

TIA
--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada

John McGhie

unread,
Apr 30, 2009, 4:48:47 AM4/30/09
to
Yes it's possible.

I need to know your version of Word and how you are entering the day number.


On 30/04/09 7:24 AM, in article 2009042915241516807-gary@NOSPAMinvalid,
"Gary" <ga...@NOSPAM.invalid> wrote:

> I am using the Date Field in a word doc and would like to have the
> "th", "rd", "st" or "nd" suffix automatically added on to the day of
> the month. i.e. 1st, 2nd, 3rd, 4th... etc.
>
> I don't have any problem getting just the day number, but I can't find
> a means of getting the suffix. Also, if there is a way to do this, can
> the suffix be super scripted?
>
> TIA

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:jo...@mcghie.name

Gary

unread,
Apr 30, 2009, 5:32:30 AM4/30/09
to
On 2009-04-30 02:48:47 -0600, John McGhie <jo...@mcghie.name> said:

> Yes it's possible.
>
> I need to know your version of Word and how you are entering the day number.

I using both Mac Office 2004 and 2008.
To enter the day I used menu "Insert>Field>Date and Time>Date" with
formating DATE \@ "d"

Also, is there a way to turn off Auto updating of the field to today's
date? I would like to have the document stay at the previously entered
date until an explicit update command is issued, like pressing the F9
key (or what ever key it would be)

>
>
> On 30/04/09 7:24 AM, in article 2009042915241516807-gary@NOSPAMinvalid,
> "Gary" <ga...@NOSPAM.invalid> wrote:
>
>> I am using the Date Field in a word doc and would like to have the
>> "th", "rd", "st" or "nd" suffix automatically added on to the day of
>> the month. i.e. 1st, 2nd, 3rd, 4th... etc.
>>
>> I don't have any problem getting just the day number, but I can't find
>> a means of getting the suffix. Also, if there is a way to do this, can
>> the suffix be super scripted?
>>
>> TIA


--
Thanks
Gary
Edmonton, Alberta, Canada

macropod

unread,
Apr 30, 2009, 9:10:05 AM4/30/09
to
Hi Gary,

To see how to do this and just about everything else you might want to do with dates in Word, check out my Word Date Calculation
Tutorial, at:
http://www.wopr.com/index.php?showtopic=249902
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Insert A Date with Ordinal Numbering'. Do read the document's introductory material.

Note: The tutorial was written for PC users, so references to Ctrl & Alt keys need to be converted to the Mac equivalents - see:
http://word.mvps.org/mac/FieldsInMacWord.html
Also, if you're using Office 2008, the vba code in the tutorial document for swapping the day & month order in the fields won't
work - you'll need to do that manually, as per the instructions in the Introduction.

As for fixing the date, you could use a CREATEDATE field instead of the DATE field.

--
Cheers
macropod
[Microsoft MVP - Word]


"Gary" <ga...@NOSPAM.invalid> wrote in message news:2009042915241516807-gary@NOSPAMinvalid...

Gary

unread,
Apr 30, 2009, 4:48:20 PM4/30/09
to
Thanks macropod for the links, I checked out the first and D/Led the
DateCalc.zip file, but reviewing the examples has me a bit confused.

For example, when reviewing the "Insert a Date with Ordinal Numbering"
section on page 4, and right click over the field and select "Toggle
Field Codes", the doc displays "Thursday the 30th of April, 2009" as
{DATE \@ "dddd 'the 30th of' MMMM, yyyy"}. This seems to say I have to
hard code the day number, which would defeat the whole purpose of have
a DATE field.

I know I'm obviously missing something as the field generates the date
correctly as it shows today's date, but I can't get the proper code to
display so I can reproduce the formating.

What am I missing here?

On 2009-04-30 07:10:05 -0600, "macropod" <macr...@invalid.invalid> said:
> Hi Gary,
>
> To see how to do this and just about everything else you might want to
> do with dates in Word, check out my Word Date Calculation Tutorial, at:
> http://www.wopr.com/index.php?showtopic=249902
> or
> http://www.gmayor.com/downloads.htm#Third_party
> In particular, look at the item titled 'Insert A Date with Ordinal
> Numbering'. Do read the document's introductory material.
>
> Note: The tutorial was written for PC users, so references to Ctrl &
> Alt keys need to be converted to the Mac equivalents - see:
> http://word.mvps.org/mac/FieldsInMacWord.html
> Also, if you're using Office 2008, the vba code in the tutorial
> document for swapping the day & month order in the fields won't work -
> you'll need to do that manually, as per the instructions in the
> Introduction.
>
> As for fixing the date, you could use a CREATEDATE field instead of the
> DATE field.


--

macropod

unread,
May 1, 2009, 12:18:20 AM5/1/09
to
Hi Gary,

The full field code is:
{DATE \@ "dddd 'the {DATE \@ d \*Ordinal} of' MMMM, yyyy"}

You simply haven't expanded all of it.

--
Cheers
macropod
[Microsoft MVP - Word]


"Gary" <ga...@NOSPAM.invalid> wrote in message news:2009043014482016807-gary@NOSPAMinvalid...

Gary

unread,
May 1, 2009, 2:05:09 AM5/1/09
to
On 2009-04-30 22:18:20 -0600, "macropod" <macr...@invalid.invalid> said:

> Hi Gary,
>

> The full field code is:
> {DATE \@ "dddd 'the {DATE \@ d \*Ordinal} of' MMMM, yyyy"}
>
> You simply haven't expanded all of it.

THANK YOU! I got it working. And now that I know what to look for, I
was able to expand the superscripted version (I think). I finally
figured out that putting the mouse directly over the superscript "th"
and right-click and selecting Toggle Field Codes 3 times to get the
field to fully expand.... yowza...

Anyway, got it working exactly as I needed.

Wheww... could it be any harder??

macropod

unread,
May 1, 2009, 2:25:53 AM5/1/09
to
Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at the coding for some of the other fields ...

--
Cheers
macropod
[Microsoft MVP - Word]


"Gary" <ga...@NOSPAM.invalid> wrote in message news:2009050100050975249-gary@NOSPAMinvalid...

Gary

unread,
May 8, 2009, 7:06:43 AM5/8/09
to
On 2009-05-01 00:25:53 -0600, "macropod" <macr...@invalid.invalid> said:

> Hi Gary,
>

> If you think that's a challenge, try pressing Option-F9 and looking at
> the coding for some of the other fields ...

Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :-)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?

macropod

unread,
May 8, 2009, 11:12:57 AM5/8/09
to
Hi Gary,

I'm really not 'au fait' with Word on the Mac, so I can't really give much help beyond what I've already posted. Perhaps one of the
Word-Mac MVPs will be along soon to help ...

--
Cheers
macropod
[Microsoft MVP - Word]


"Gary" <ga...@NOSPAM.invalid> wrote in message news:2009050805064316807-gary@NOSPAMinvalid...

John McGhie

unread,
May 8, 2009, 11:01:06 PM5/8/09
to
Hi Gary:

There's no "Trick" to it, other than "type carefully" :-)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers


On 8/05/09 9:06 PM, in article 2009050805064316807-gary@NOSPAMinvalid,
"Gary" <ga...@NOSPAM.invalid> wrote:

--

macropod

unread,
May 9, 2009, 4:14:12 AM5/9/09
to
Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among other things. On my reading, it seems when he presses F9,
only one of the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have tried to code in code in new macros using CMD-F9"), but that's
not especially important. As you say, careful attention to detail is the key.

--
Cheers
macropod
[Microsoft MVP - Word]


"John McGhie" <jo...@mcghie.name> wrote in message news:C62B2F12.1EE7A%jo...@mcghie.name...

Gary

unread,
May 21, 2009, 8:58:57 AM5/21/09
to
On 2009-05-09 02:14:12 -0600, "macropod" <macr...@invalid.invalid> said:

OK, Back late to the party...

Thanks for chiming in John. Believe me, you are preaching to the choir
as I have been a programmer for IBM 13 yrs, and I very much know the
pitfalls of type-os. I've been bitten by them too many times to
mention, But that is not the problem here.

When I generate the macro using insert field and get the pop-up window
to create an ordinal date, the following code is generated:
{ CREATEDATE \@ d \*Ordinal \* MERGEFORMAT }

However, if I use CMD-F9 to create a field and enter (copy/paste) the
exact Code, when I hit Opt-F9 to execute the code, the code simply
disappears: no error, no warnings, no ordinal date.... nada, white. I
press Opt-F9 again and the code reappears. I also have invisibles
turned on and the end of line moves right back to the start of the line
and is not displaced by a white text on white paper.

As in the original generated code, I have verified that there is a
single space after the start brace, and a single space before the end
brace. Since I copied (CMD-C) the generated code and pasted (CMD-V) it
directly between the new braces, there is no possibility of a type-o.

Although I have coded in well over 100 different language, including
VB, this is my first endeavor into Word fields, and at first sight, the
syntax is straight forward, but I am having a dickens of a time
implementing any code that is NOT generated by Word.

I really appreciate both of your time and patience helping me figure
this out. At this point, implementing nested code is impossible.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada

> Hi John,

macropod

unread,
May 21, 2009, 9:55:00 PM5/21/09
to
Hi Gary,

If all you need is a field that does as the one in my tutorial does, why aren't you simply copying & pasting the one from the
tutorial into your document?

Amongtst other things, it seems you're trying to copy & paste the field from the tutorial into a new field in your document. That
will certainly cause the kind of 'disappearing' problems you're having.

--
Cheers
macropod
[Microsoft MVP - Word]


"Gary" <ga...@NOSPAM.invalid> wrote in message news:2009052106585716807-gary@NOSPAMinvalid...

John McGhie

unread,
May 23, 2009, 7:11:04 AM5/23/09
to
Hi Gary:

Well, your code worked perfectly here when I tried it.

As Macropod says, you need to be careful what you paste!

I selected everything between (but not including) your curly braces, and
pasted that into a field pair created with Cmd + F9.

Then I updated the field and I got "23rd" which is what you would expect.

Cheers


On 21/05/09 10:58 PM, in article 2009052106585716807-gary@NOSPAMinvalid,

Gary

unread,
Jun 3, 2009, 8:08:21 AM6/3/09
to
On 2009-05-21 19:55:00 -0600, "macropod" <macr...@invalid.invalid> said:

> Hi Gary,
>

> If all you need is a field that does as the one in my tutorial does,
> why aren't you simply copying & pasting the one from the tutorial into
> your document?

And there lies the rub... copying/pasting the code from the tutorial,
results in the exact same results as when I copy/paste code I
created... it simply disappears... no errors...etc.

>
> Amongtst other things, it seems you're trying to copy & paste the field
> from the tutorial into a new field in your document. That will
> certainly cause the kind of 'disappearing' problems you're having.

As with my code, I selected and copied the code "between" the
outer-most braces.

This should be so simple, but I seems to be going in circles.

Gary

unread,
Jun 3, 2009, 8:28:39 AM6/3/09
to
On 2009-05-23 05:11:04 -0600, John McGhie <jo...@mcghie.name> said:

> Hi Gary:
>
> Well, your code worked perfectly here when I tried it.
>
> As Macropod says, you need to be careful what you paste!
>
> I selected everything between (but not including) your curly braces, and
> pasted that into a field pair created with Cmd + F9.
>
> Then I updated the field and I got "23rd" which is what you would expect.

Thanks John. "Updated the field" was the one step I did not have. I
just expected the field to display after inserting the code and
pressing Opt+F9, because all the existing fields were display.

I was so frustrated I could not even conceive that I would have to
update just that specific field.

Finally, I can stop loosing sleep over this!

MANY Thanks got to both you and macropod for your patience and help.

John McGhie

unread,
Jun 4, 2009, 3:52:40 AM6/4/09
to
Hi Gary:

Well, I'm glad you got it sorted :-)

Word has three kinds of field: "Hot", "Warm", and "Cold".

A Hot field updates instantly and automatically. AutoNum and Page are
frequently-used examples.

A Warm field updates only at defined document events, such as "Open". Most
of the Date fields are like this: if you leave a document open overnight,
the date will not change unless you reopen the document.

A Cold field updates only when you update it. Most fields are like this:
TOC, Index, Document Properties...

No, sorry, there's no documentation anywhere to tell you which is which...

Cheers

On 3/06/09 10:28 PM, in article 2009060306283975249-gary@NOSPAMinvalid,

0 new messages