Date formating in a Word document

N

Nick Gol

Hi Folks,

I have this field in a document

{QUOTE "7/9/2003"\@"dd MMMM yyyy"\*MERGEFORMAT}

This field specification is actually being generated dynamically. The
date "7/9/20003" has come from a database and I know the format of the
date. ie it may be m/d/yyyy or d/m/yyyy.

Does anyone know how I can modify the field specification above so
that I can inform Word what the date format of the original date
"7/9/2003" was.

At the moment Word is using the control panel/regional settings to
decide what the date format of "7/9/2003" is before formating it using
"dd MMMM yyyyy".
Instead I need to inform Word what the original format was.

Thanks in advance

Nick
 
P

Phill. W

.. . .
{QUOTE "7/9/2003"\@"dd MMMM yyyy"\*MERGEFORMAT} .. . .
Does anyone know how I can modify the field specification above
so that I can inform Word what the date format of the original date
"7/9/2003" was.

Word doesn't know and doesn't care. You're asking it for format a
date and that's what it's doing, to the best of its ability. Unfortunately,
that ability involves trying to honour the regional settings on the machine,
hence your problem. Word is not alone in this respect.
. . . has come from a database and I know the format of the date.

Do you or do you not know the original format of the date as it is
held in your database? Actually, if you're holding it in a "Date" (or
similar) field, as you should be, the question is irrelevent. They don't
have an internal "format" and you can force them to look whichever
way you want. /If/ you're holding them as Strings and /not/ controlling
the format in which they're stored, you're in big trouble!

Try this:
{QUOTE "2003-09-07" \@"dd MMMM yyyy" \*MERGEFORMAT}

HTH,
Phill W.
 
N

Nick Gol

Thanks Phill,

That's help me understand what's causing the problem.

The date is unfortunatly only available in the form of a string.
Though at the point when I receive the string I also know what the
corresponding date format was. So the Word document is initially
generated correctly. It's just at some time in the future when, by
changing the system date format, the document starts displaying a
different date!

Looks like I'll have to think of some alternative way of displaying
the date!

Thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top