Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / December 2003

Tip: Looking for answers? Try searching our database.

Date format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gyom - 03 Dec 2003 02:06 GMT
I am importing contacts information form Act. I need to mention a date in the past.
When imported, the date format is so: 20031128
How do I transform this into Friday, November 28 2003
I tried all I could find on this forum like \@ "d MMMM yyyy" but nothing seems to work.
The format never changed.
Any suggestion?
THanks
Gyom
Cindy M  -WordMVP- - 03 Dec 2003 18:16 GMT
Hi =?Utf-8?B?Z3lvbQ==?=,

> I am importing contacts information form Act. I need to mention a date in the past.
> When imported, the date format is so: 20031128
> How do I transform this into Friday, November 28 2003
> I tried all I could find on this forum like \@ "d MMMM yyyy" but nothing seems to work.
> The format never changed.

Word won't recognize this as a date, and it has no string manipulation functions that
could pull this apart, so this could get a bit tricky. I'd try setting up a set of
nested fields along these lines:

{ Quote "{ = { Mergefield Date } \# "0000'-'00'-'00" }" \@ "MMMM d, yyyy" }

Pay special attention to the "quotes" and 'apostrophes'

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :-)
macropod - 06 Dec 2003 10:25 GMT
Hi gyom,

If your imported date is always 8 characters long, you could use the
following compound field to convert it into the "Friday, November 28, 2003"
day/date format:

{QUOTE
{SET Data 20031128}
{SET d{=MOD(Data,100)}}
{SET m{=INT(MOD(Data,10000)/100)}}
{SET y{=INT(Data/10000)}}
{SET
jd{=INT(365.25*(y+4799+INT((m+10)/12)))+INT(367/12*MOD(m+10,12))-INT(3*INT((
y+4901+INT((m+10)/12))/100)/4)+d-32075}}
{SET c{=jd+68569-INT(36524.25*INT((jd+68569)/36524.25)+0.75)}}
{SET f{=c-INT(365.25*INT((c+1)/365.25025))+31}}
{SET dd{=f-INT(30.58757*INT(f/30.58757))}}
{SET mm"{=INT(f/30.58757)+2-12*INT(INT(f/30.58757)/11)}/00"}
{SET
yy{=100*(INT((jd+68569)/36524.25)-49)+INT((c+1)/365.25025)+INT(INT(f/30.5875
7)/11)}}
{IF{=MOD(jd,7)}= 0 Mon {IF{=MOD(jd,7)}= 1 Tues {IF{=MOD(jd,7)}= 2 Wednes
{IF{=MOD(jd,7)}= 3 Thurs {IF{=MOD(jd,7)}= 4 Fri {IF{=MOD(jd,7)}= 5 Satur
Sun}}}}}}day
44 160{mm \@ MMM}160{dd}44 160{yy}}

Yes, it's all one field - I've just broken it into logical segments to
improve readability. Most of the effort goes into converting the date into a
Julian day number from which you can extract the weekday.

Cheers

> I am importing contacts information form Act. I need to mention a date in the past.
> When imported, the date format is so: 20031128
[quoted text clipped - 4 lines]
>  THanks
> Gyom
Cindy M  -WordMVP- - 06 Dec 2003 11:47 GMT
Hi Macropod,

> If your imported date is always 8 characters long, you could use the
> following compound field to convert it into the "Friday, November 28, 2003"
> day/date format:

Why so complicated :-)? Have you found some problems with how the single
Quote field I proposed works?

   Cindy Meister
macropod - 07 Dec 2003 05:26 GMT
Hi Cindy,

As I said in my post, most of the complication is to do with extracting the
day of the week, as per the original request, which I don't believe to be
possible otherwise.

Cheers
PS: I Should have had an extra 'M' in the final month switch, too, to return
the full month name instead of the abbreviated version.

> Hi Macropod,
>
[quoted text clipped - 6 lines]
>
>     Cindy Meister
macropod - 07 Dec 2003 07:20 GMT
Actually, forget my last post too - I've just realised that the same result
could have been achived by changing the date switch in your field to:
"dddd, MMMM d, yyyy"

DOH!!!

Cheers

> Hi Macropod,
>
[quoted text clipped - 6 lines]
>
>     Cindy Meister
Cindy M  -WordMVP- - 07 Dec 2003 11:12 GMT
Hi Macropod,

> Actually, forget my last post too - I've just realised that the same result
> could have been achived by changing the date switch in your field to:
> "dddd, MMMM d, yyyy"

<BG>

   Cindy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.